Skip to content

Commit efcb653

Browse files
author
Orta Therox
authored
Merge pull request #895 from abu-co/master
Add syntax highlighting for JSDoc "template" tags with constraints.
2 parents 53b4eaa + 56b7270 commit efcb653

File tree

3 files changed

+75
-0
lines changed

3 files changed

+75
-0
lines changed

TypeScript.YAML-tmLanguage

+11
Original file line numberDiff line numberDiff line change
@@ -3028,6 +3028,17 @@ repository:
30283028
# patterns:
30293029
# - name: punctuation.delimiter.object.comma.jsdoc
30303030
# match: ','
3031+
# @template {Constraint} Foo
3032+
- begin: (?x)((@)template)\s+(?={)
3033+
beginCaptures:
3034+
'1': { name: storage.type.class.jsdoc }
3035+
'2': { name: punctuation.definition.block.tag.jsdoc }
3036+
end: (?=\s|\*/|[^{}\[\]A-Za-z_$])
3037+
patterns:
3038+
- include: '#jsdoctype'
3039+
- name: variable.other.jsdoc
3040+
# One valid identifier
3041+
match: ([A-Za-z_$][\w$.\[\]]*)
30313042
# Tags followed by an identifier token
30323043
# - @<tag> identifier
30333044
- match: |-

TypeScript.tmLanguage

+32
Original file line numberDiff line numberDiff line change
@@ -9096,6 +9096,38 @@
90969096
</dict>
90979097
</dict>
90989098
</dict>
9099+
<dict>
9100+
<key>begin</key>
9101+
<string>(?x)((@)template)\s+(?={)</string>
9102+
<key>beginCaptures</key>
9103+
<dict>
9104+
<key>1</key>
9105+
<dict>
9106+
<key>name</key>
9107+
<string>storage.type.class.jsdoc</string>
9108+
</dict>
9109+
<key>2</key>
9110+
<dict>
9111+
<key>name</key>
9112+
<string>punctuation.definition.block.tag.jsdoc</string>
9113+
</dict>
9114+
</dict>
9115+
<key>end</key>
9116+
<string>(?=\s|\*/|[^{}\[\]A-Za-z_$])</string>
9117+
<key>patterns</key>
9118+
<array>
9119+
<dict>
9120+
<key>include</key>
9121+
<string>#jsdoctype</string>
9122+
</dict>
9123+
<dict>
9124+
<key>name</key>
9125+
<string>variable.other.jsdoc</string>
9126+
<key>match</key>
9127+
<string>([A-Za-z_$][\w$.\[\]]*)</string>
9128+
</dict>
9129+
</array>
9130+
</dict>
90999131
<dict>
91009132
<key>match</key>
91019133
<string>(?x)

TypeScriptReact.tmLanguage

+32
Original file line numberDiff line numberDiff line change
@@ -9044,6 +9044,38 @@
90449044
</dict>
90459045
</dict>
90469046
</dict>
9047+
<dict>
9048+
<key>begin</key>
9049+
<string>(?x)((@)template)\s+(?={)</string>
9050+
<key>beginCaptures</key>
9051+
<dict>
9052+
<key>1</key>
9053+
<dict>
9054+
<key>name</key>
9055+
<string>storage.type.class.jsdoc</string>
9056+
</dict>
9057+
<key>2</key>
9058+
<dict>
9059+
<key>name</key>
9060+
<string>punctuation.definition.block.tag.jsdoc</string>
9061+
</dict>
9062+
</dict>
9063+
<key>end</key>
9064+
<string>(?=\s|\*/|[^{}\[\]A-Za-z_$])</string>
9065+
<key>patterns</key>
9066+
<array>
9067+
<dict>
9068+
<key>include</key>
9069+
<string>#jsdoctype</string>
9070+
</dict>
9071+
<dict>
9072+
<key>name</key>
9073+
<string>variable.other.jsdoc</string>
9074+
<key>match</key>
9075+
<string>([A-Za-z_$][\w$.\[\]]*)</string>
9076+
</dict>
9077+
</array>
9078+
</dict>
90479079
<dict>
90489080
<key>match</key>
90499081
<string>(?x)

0 commit comments

Comments
 (0)