Skip to content

Commit 32ce970

Browse files
Tree-sitter rolling fixes, 1.129 edition (#1300)
* Fix a bug in `tree-sitter-scss`… …where `color:red;` was interpreted as a tag and pseudoclass instead of a property-value pair. * [language-sass] Add grammar spec for fixed issue in `tree-sitter-scss` * [language-typescript] Highlight `abstract` modifier properly… …plus the names of abstract methods in class definitions.
1 parent 0e891b2 commit 32ce970

6 files changed

Lines changed: 47 additions & 1 deletion

File tree

packages/language-sass/grammars/modern-tree-sitter-scss.cson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fileTypes: [
1515
injectionRegex: '^(scss|SCSS)$'
1616

1717
treeSitter:
18-
parserSource: 'github:savetheclocktower/tree-sitter-scss#090d25a5fc829ce6956201cf55ab6b6eacad999c'
18+
parserSource: 'github:savetheclocktower/tree-sitter-scss#f5dfc3b4609d01fb11af8c97f3948fffeff25e92'
1919
grammar: 'tree-sitter/tree-sitter-scss.wasm'
2020
highlightsQuery: 'tree-sitter/highlights.scm'
2121
foldsQuery: 'tree-sitter/folds.scm'
-1.32 KB
Binary file not shown.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"env": { "jasmine": true },
3+
"globals": {
4+
"waitsForPromise": true,
5+
"runGrammarTests": true,
6+
"runFoldsTests": true
7+
},
8+
"rules": {
9+
"node/no-unpublished-require": "off",
10+
"node/no-extraneous-require": "off",
11+
"no-unused-vars": "off",
12+
"no-empty": "off"
13+
}
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
div {
3+
color: red;
4+
// ^ support.type.property-name.scss
5+
// ^ support.constant.color
6+
color:red;
7+
// ^ support.type.property-name.scss
8+
// ^ support.constant.color
9+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const path = require('path');
2+
3+
const GRAMMAR_TEST_FILES = [
4+
'test.scss'
5+
];
6+
7+
describe('Grammar tests', () => {
8+
beforeEach(async () => {
9+
atom.config.set('core.useTreeSitterParsers', true);
10+
await atom.packages.activatePackage("language-sass");
11+
});
12+
13+
it('passes grammar tests', async () => {
14+
for (let file of GRAMMAR_TEST_FILES) {
15+
await runGrammarTests(path.join(__dirname, 'fixtures', 'grammar', file), /\/\//)
16+
}
17+
});
18+
});

packages/language-typescript/grammars/common/highlights.scm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@
407407
"protected"
408408
"readonly"
409409
"satisfies"
410+
"abstract"
410411
] @storage.modifier._TYPE_._LANG_
411412

412413
(index_signature
@@ -718,6 +719,10 @@
718719
key: (property_identifier) @entity.name.function.method.definition._LANG_
719720
value: [(function_expression) (arrow_function)])
720721

722+
; Abstract function declaration:
723+
; The "foo" in `abstract foo(): void`
724+
(abstract_method_signature name: (_) @entity.name.function.method.definition.abstract._LANG_)
725+
721726
; Function is `storage.type` because it's a core language construct.
722727
(function_expression "function" @storage.type.function._LANG_)
723728
(function_declaration "function" @storage.type.function._LANG_)

0 commit comments

Comments
 (0)