Last active
June 17, 2024 15:04
-
-
Save lac5/ba24f579be2f7e329eaeb86e5ab6a7a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML1.2 | |
--- | |
# Put this file somewhere Sublime Text can find it. | |
# For example: `%APPDATA%\Sublime Text 3\Packages\User` on Windows. | |
# Then replace `comments` in whatever sublime-syntax file with this: | |
# | |
# comments: | |
# - match: (?=/\*)|(?=//) | |
# push: Packages/User/{name of this file} | |
# | |
hidden: true | |
scope: ... | |
contexts: | |
main: | |
- meta_scope: comment.block.documentation.js | |
- match: (?!/\*)(?!//) | |
scope: punctuation.definition.comment.end.js | |
pop: true | |
- match: '/\*::?' | |
scope: punctuation.definition.comment.start.js | |
push: Packages/TypeScript/TypeScript.tmLanguage | |
with_prototype: | |
- match: \*/ | |
scope: punctuation.definition.comment.end.js | |
set: main | |
- match: /// | |
push: Packages/XML/XML.sublime-syntax | |
with_prototype: | |
- match: \n | |
pop: true | |
- match: |- | |
(?xi) | |
/\* | |
[^\n\S]* | |
( global ) | |
[^\n\S]+ | |
( (?: (?!\*/) \S )+ ) | |
[^\n\S]* | |
\*/ | |
scope: comment.line.block.js | |
captures: | |
1: storage.type.class.jsdoc | |
2: variable.other.jsdoc | |
- match: /\* | |
scope: punctuation.definition.comment.begin.js | |
push: block_comment | |
with_prototype: | |
- match: \*/ | |
scope: punctuation.definition.comment.end.js | |
pop: true | |
- match: (?<=/\*)\*|^[^\n\S]*\*+[^\n\S] | |
push: doc_comment | |
with_prototype: | |
- match: \n|(?=\*/) | |
pop: true | |
- match: // | |
scope: punctuation.definition.comment.start.js | |
push: double_slash_comment | |
with_prototype: | |
- match: \n | |
scope: punctuation.definition.comment.end.js | |
pop: true | |
formatting: | |
- match: |- | |
(?xi) | |
https?:// | |
(?:[\w-]+\.)* [\w-]+ | |
(?: : \d+ )? | |
(?: [/?] (?: [\w~!@&=;:,./?-] | %[0-9a-f]{2} )* )? | |
(?: \# [\w~!@&=;:,./?%-]* )? | |
scope: string.quote | |
- match: |- | |
(?xi) | |
(?:^|\s) | |
< (?: (?!\*/) (?!>) . )* > | |
(?:\s|$) | |
scope: string.quote | |
- match: |- | |
(?xi) | |
(?:^|\s) | |
( \* (?!\/) | _ ) | |
(?!\*/) (?!\1) \S | |
(?: (?!\*/) (?!\1) . )* | |
(?!\*/) (?!\1) \S | |
\1 | |
(?:\s|$) | |
scope: variable.other.jsdoc | |
- match: |- | |
(?xi) | |
(?:^|\s) | |
( \*\* (?!\/) | __ | -- | == ) | |
(?!\*/) (?!\1) \S | |
(?: (?!\*/) (?!\1) . )* | |
(?!\*/) (?!\1) \S | |
\1 | |
(?:\s|$) | |
scope: storage.type.class.jsdoc | |
- match: |- | |
(?xi) | |
( \[ (?: (?!\*/) (?!\]) . )* \] )? | |
( \{ ) | |
(@ (?: | |
link | |
| url | |
)) | |
[^\n\S]+ | |
( (?: (?!\*/) (?!\}) (?!\|) \S )* ) | |
(?: | |
( \| | [^\n\S]+ ) | |
( (?: (?!\*/) (?!\}) . )* ) | |
)? | |
( \} ) | |
captures: | |
1: variable.other.jsdoc | |
2: entity.name.type.instance.jsdoc | |
3: storage.type.class.jsdoc | |
4: string.quote | |
5: entity.name.type.instance.jsdoc | |
6: variable.other.jsdoc | |
7: entity.name.type.instance.jsdoc | |
- match: |- | |
(?xi) | |
( \[ (?: (?!\*/) (?!\]) . )* \] ) | |
( \( ) | |
[^\n\S]+ | |
( (?: (?!\*/) (?!\)) \S )* ) | |
( (?: (?!\*/) (?!\)) . )* )? | |
( \) ) | |
captures: | |
1: variable.other.jsdoc | |
2: entity.name.type.instance.jsdoc | |
3: string.quote | |
4: variable.other.jsdoc | |
5: entity.name.type.instance.jsdoc | |
double_slash_comment: | |
- meta_scope: comment.double-slash.js | |
- include: standard_comment | |
block_comment: | |
- meta_scope: comment.block.js | |
- include: standard_comment | |
standard_comment: | |
- include: formatting | |
- match: '[A-Z][A-Z0-9_-]*:' | |
scope: constant.other.description.jsdoc | |
- match: '[@#][\w.:-]+' | |
scope: storage.type.class.jsdoc | |
doc_comment: | |
- include: formatting | |
- match: // | |
scope: punctuation.definition.comment.js | |
push: double_slash_comment | |
with_prototype: | |
- match: (?=\n)|(?=\*/) | |
pop: true | |
- match: |- | |
(?xi) | |
(@ (?: | |
params? | |
| typedef | |
| property | |
| class | |
| global | |
)) | |
(?:[^\n\S]+ | |
( \{ (?: (?!\*/) . )*? \} ) | |
)? | |
(?:[^\n\S]+ | |
( (?: (?!\*/) \S )+ ) | |
)? | |
captures: | |
1: storage.type.class.jsdoc | |
2: entity.name.type.instance.jsdoc | |
3: variable.other.jsdoc | |
- match: |- | |
(?xi) | |
(@ (?: | |
module | |
| see | |
| alias | |
| exports? | |
| extends | |
| memberof | |
)) | |
(?:[^\n\S]+ | |
( (?: (?!\*/) \S )+ ) | |
)? | |
captures: | |
1: storage.type.class.jsdoc | |
2: entity.name.type.instance.jsdoc | |
- match: |- | |
(?xi) | |
(@ (?: | |
[\w.:-]+ | |
)) | |
(?:[^\n\S]+ | |
( (?: (?!\*/) \S )+ ) | |
)? | |
captures: | |
1: storage.type.class.jsdoc | |
2: entity.name.type.instance.jsdoc | |
- match: '.' | |
scope: constant.other.description.jsdoc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment