File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Syntaxes
2
+
3
+ This directory specifies
4
+ [ TextMate grammars] ( https://macromates.com/manual/en/language_grammars ) used by
5
+ VSCode to syntax highlight Angular source code.
6
+
7
+ ## Adding a new grammar
8
+
9
+ To add a new grammar (not modifying an existing one), write the grammar as a
10
+ JSON file in this directory and register it in the root directory's
11
+ [ package.json] ( ./package.json ) under the ` contributes.grammars ` array.
12
+
13
+ ## Testing grammars
14
+
15
+ This repository uses
16
+ [ vscode-tmgrammar-test] ( https://github.com/PanAeon/vscode-tmgrammar-test ) for
17
+ testing VSCode TextMate grammars.
18
+
19
+ ### Snapshot Tests
20
+
21
+ Snapshot test cases are specified in [ test/cases.json] ( ./test/cases.json ) .
22
+
23
+ - The source file to test the grammar on should go in [ test/data/] ( ./test/data ) .
24
+ - If an external grammar is needed (e.g. for HTML) is needed, a dummy grammar
25
+ can be specified in [ test/dummy/] ( ./test/dummy ) and will be automatically
26
+ picked up by the grammar test driver.
27
+ - Each snapshot tests requires a language scope to test. Generally, this is the
28
+ scope name of the grammar being tested (e.g. ` inline-template.ng ` for the
29
+ inline template grammar). This scope will become the base name of the grammar
30
+ matched for everything in the source file being tested, upon which more
31
+ specific grammar matches will be stacked.
32
+
33
+ Snapshot golden files can be updated by running
34
+
35
+ ``` bash
36
+ yarn test:syntaxes -u
37
+ ```
38
+
39
+ in the root directory of this repository. Goldens must be updated when a new
40
+ test case is added. Be sure to check that the updated golden file looks as you
41
+ expect.
You can’t perform that action at this time.
0 commit comments