Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit dc9da58

Browse files
exclude embedded scopes from assertions; exclude 1 specific WIP test
1 parent ccd9f1a commit dc9da58

2 files changed

Lines changed: 17 additions & 7 deletions

File tree

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ exports.activate = function() {
1515
content (node) { return node.descendantsOfType('content') }
1616
})
1717

18-
// inject TODO comments into PHP comments
18+
// inject phpDoc comments into PHP comments
1919
atom.grammars.addInjectionPoint('source.php', {
2020
type: 'comment',
2121
language (comment) {

spec/tree-sitter-spec.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
const dedent = require("dedent");
22

3-
const getScopesAtPosition = (editor, position) =>
4-
editor.scopeDescriptorForBufferPosition(position).scopes;
5-
63
// https://github.com/atom/atom/blob/b3d3a52d9e4eb41f33df7b91ad1f8a2657a04487/spec/tree-sitter-language-mode-spec.js#L47-L55
74
function expectTokensToEqual (editor, expectedTokenLines, startingRow = 1) {
85
const lastRow = editor.getLastScreenRow()
@@ -51,7 +48,12 @@ ${dedent(content)}
5148

5249
beforeEach(function () {
5350
this.addMatchers({
54-
toHaveScopesAtPosition(posn, token, expected) {
51+
toHaveScopesAtPosition(
52+
posn,
53+
token,
54+
expected,
55+
includeEmbeddedScopes = false
56+
) {
5557
if (expected === undefined) {
5658
expected = token;
5759
}
@@ -62,7 +64,14 @@ ${dedent(content)}
6264
// token is not used at this time; it's just a way to keep note where we are
6365
// in the line
6466

65-
let actual = getScopesAtPosition(this.actual, posn);
67+
let actual = this.actual
68+
.scopeDescriptorForBufferPosition(posn).scopes
69+
.filter(
70+
scope => includeEmbeddedScopes ||
71+
![
72+
'text.html.php',
73+
'meta.embedded.block.php',
74+
].includes(scope))
6675

6776
let notExpected = actual.filter((scope) => !expected.includes(scope));
6877
let notReceived = expected.filter((scope) => !actual.includes(scope));
@@ -119,7 +128,8 @@ ${caret}
119128
});
120129
});
121130

122-
describe("html embedding", () => {
131+
// FIXME temporarily disabled
132+
xdescribe("html embedding", () => {
123133
it("handles php wrapped in html", () => {
124134
editor.setText(dedent `
125135
<div>

0 commit comments

Comments
 (0)