Skip to content

Commit 91294ab

Browse files
committed
Support custom jsdoc tags
Fixes #688
1 parent ccdbd2e commit 91294ab

File tree

5 files changed

+90
-0
lines changed

5 files changed

+90
-0
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,11 @@ repository:
29002900
captures:
29012901
'1': { name: punctuation.definition.block.tag.jsdoc }
29022902
- include: '#inline-tags'
2903+
# any tag
2904+
- match: ((@)(?:{{identifier}}))(?=\s+)
2905+
captures:
2906+
'1': { name: storage.type.class.jsdoc }
2907+
'2': { name: punctuation.definition.block.tag.jsdoc }
29032908

29042909
brackets:
29052910
# Balanced brackets (square or curly)

TypeScript.tmLanguage

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8448,6 +8448,23 @@
84488448
<key>include</key>
84498449
<string>#inline-tags</string>
84508450
</dict>
8451+
<dict>
8452+
<key>match</key>
8453+
<string>((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\s+)</string>
8454+
<key>captures</key>
8455+
<dict>
8456+
<key>1</key>
8457+
<dict>
8458+
<key>name</key>
8459+
<string>storage.type.class.jsdoc</string>
8460+
</dict>
8461+
<key>2</key>
8462+
<dict>
8463+
<key>name</key>
8464+
<string>punctuation.definition.block.tag.jsdoc</string>
8465+
</dict>
8466+
</dict>
8467+
</dict>
84518468
</array>
84528469
</dict>
84538470
<key>brackets</key>

TypeScriptReact.tmLanguage

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8394,6 +8394,23 @@
83948394
<key>include</key>
83958395
<string>#inline-tags</string>
83968396
</dict>
8397+
<dict>
8398+
<key>match</key>
8399+
<string>((@)(?:[_$[:alpha:]][_$[:alnum:]]*))(?=\s+)</string>
8400+
<key>captures</key>
8401+
<dict>
8402+
<key>1</key>
8403+
<dict>
8404+
<key>name</key>
8405+
<string>storage.type.class.jsdoc</string>
8406+
</dict>
8407+
<key>2</key>
8408+
<dict>
8409+
<key>name</key>
8410+
<string>punctuation.definition.block.tag.jsdoc</string>
8411+
</dict>
8412+
</dict>
8413+
</dict>
83978414
</array>
83988415
</dict>
83998416
<key>brackets</key>

tests/baselines/Issue688.baseline.txt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
original file
2+
-----------------------------------
3+
/**
4+
* @privateRemarks
5+
* Bla bla bla.
6+
*/
7+
const foo = 1
8+
-----------------------------------
9+
10+
Grammar: TypeScript.tmLanguage
11+
-----------------------------------
12+
>/**
13+
^^^
14+
source.ts comment.block.documentation.ts punctuation.definition.comment.ts
15+
> * @privateRemarks
16+
^^^
17+
source.ts comment.block.documentation.ts
18+
^
19+
source.ts comment.block.documentation.ts storage.type.class.jsdoc punctuation.definition.block.tag.jsdoc
20+
^^^^^^^^^^^^^^
21+
source.ts comment.block.documentation.ts storage.type.class.jsdoc
22+
^^
23+
source.ts comment.block.documentation.ts
24+
> * Bla bla bla.
25+
^^^^^^^^^^^^^^^^
26+
source.ts comment.block.documentation.ts
27+
> */
28+
^
29+
source.ts comment.block.documentation.ts
30+
^^
31+
source.ts comment.block.documentation.ts punctuation.definition.comment.ts
32+
>const foo = 1
33+
^^^^^
34+
source.ts meta.var.expr.ts storage.type.ts
35+
^
36+
source.ts meta.var.expr.ts
37+
^^^
38+
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts meta.definition.variable.ts variable.other.constant.ts
39+
^
40+
source.ts meta.var.expr.ts meta.var-single-variable.expr.ts
41+
^
42+
source.ts meta.var.expr.ts keyword.operator.assignment.ts
43+
^
44+
source.ts meta.var.expr.ts
45+
^
46+
source.ts meta.var.expr.ts constant.numeric.decimal.ts

tests/cases/Issue688.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* @privateRemarks
3+
* Bla bla bla.
4+
*/
5+
const foo = 1

0 commit comments

Comments
 (0)