Skip to content

Commit d3a3765

Browse files
committed
Update the jsdoc grammar to atom/language-javascript@14e02bd
1 parent 137e542 commit d3a3765

File tree

5 files changed

+189
-18
lines changed

5 files changed

+189
-18
lines changed

TypeScript.YAML-tmLanguage

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ repository:
20832083
# @access private|protected|public
20842084
- match: |-
20852085
(?x)
2086-
((@)access)
2086+
((@)(?:access|api))
20872087
\s+
20882088
(private|protected|public)
20892089
\b
@@ -2175,7 +2175,15 @@ repository:
21752175
(?:
21762176
# URL
21772177
(
2178-
(?=https?://)
2178+
(?!
2179+
# Avoid matching bare URIs (also acceptable as links)
2180+
https?://
2181+
|
2182+
# Avoid matching {@inline tags}; we match those below
2183+
(?:\[[^\[\]]*\])? # Possible description [preceding]{@tag}
2184+
{@(?:link|linkcode|linkplain|tutorial)\b
2185+
)
2186+
# Matched namepath
21792187
(?:[^\s*]|\*[^/])+
21802188
)
21812189
|
@@ -2251,7 +2259,44 @@ repository:
22512259
- include: '#jsdoctype'
22522260
- name: variable.other.jsdoc
22532261
match: ([A-Za-z_$][\w$.\[\]]*)
2262+
# Optional value
22542263
- name: variable.other.jsdoc
2264+
match: |-
2265+
(?x)
2266+
(\[)\s*
2267+
[\w$]+
2268+
(?:
2269+
(?:\[\])? # Foo[ ].bar properties within an array
2270+
\. # Foo.Bar namespaced parameter
2271+
[\w$]+
2272+
)*
2273+
(?:
2274+
\s*
2275+
(=) # [foo=bar] Default parameter value
2276+
\s*
2277+
(
2278+
# The inner regexes are to stop the match early at */ and to not stop at escaped quotes
2279+
(?:
2280+
"(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted
2281+
'(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted
2282+
\[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal
2283+
(?:(?:\*(?!/))|[^*])*? # Everything else
2284+
)*
2285+
)
2286+
)?
2287+
\s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/))
2288+
captures:
2289+
'1': { name: punctuation.definition.optional-value.begin.bracket.square.jsdoc }
2290+
'2': { name: keyword.operator.assignment.jsdoc }
2291+
'3':
2292+
name: source.embedded.ts
2293+
# Commenting out the embedded pattern matching since sublime doesnt support this
2294+
# patterns:
2295+
# - include: '#inline-tags'
2296+
# - include: source.js
2297+
'4': { name: punctuation.definition.optional-value.end.bracket.square.jsdoc }
2298+
'5': { name: invalid.illegal.syntax.jsdoc }
2299+
22552300
begin: '\['
22562301
end: '\]|(?=\*/)'
22572302
patterns:
@@ -2327,16 +2372,16 @@ repository:
23272372
- name: storage.type.class.jsdoc
23282373
match: >-
23292374
(?x) (@)
2330-
(?:abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbles
2375+
(?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles
23312376
|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright
23322377
|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception
23332378
|exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func
2334-
|function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface|kind
2335-
|lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module|name|namespace
2336-
|noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve|private|prop
2337-
|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule
2338-
|summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation
2339-
|version|virtual|writeOnce)
2379+
|function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface
2380+
|internal|kind|lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module
2381+
|name|namespace|noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve
2382+
|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static
2383+
|struct|submodule|summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted
2384+
|uses|var|variation|version|virtual|writeOnce)
23402385
\b
23412386
captures:
23422387
'1': { name: punctuation.definition.block.tag.jsdoc }

TypeScript.tmLanguage

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5746,7 +5746,7 @@
57465746
<dict>
57475747
<key>match</key>
57485748
<string>(?x)
5749-
((@)access)
5749+
((@)(?:access|api))
57505750
\s+
57515751
(private|protected|public)
57525752
\b</string>
@@ -5968,7 +5968,15 @@
59685968
(?:
59695969
# URL
59705970
(
5971-
(?=https?://)
5971+
(?!
5972+
# Avoid matching bare URIs (also acceptable as links)
5973+
https?://
5974+
|
5975+
# Avoid matching {@inline tags}; we match those below
5976+
(?:\[[^\[\]]*\])? # Possible description [preceding]{@tag}
5977+
{@(?:link|linkcode|linkplain|tutorial)\b
5978+
)
5979+
# Matched namepath
59725980
(?:[^\s*]|\*[^/])+
59735981
)
59745982
|
@@ -6142,6 +6150,58 @@
61426150
<dict>
61436151
<key>name</key>
61446152
<string>variable.other.jsdoc</string>
6153+
<key>match</key>
6154+
<string>(?x)
6155+
(\[)\s*
6156+
[\w$]+
6157+
(?:
6158+
(?:\[\])? # Foo[ ].bar properties within an array
6159+
\. # Foo.Bar namespaced parameter
6160+
[\w$]+
6161+
)*
6162+
(?:
6163+
\s*
6164+
(=) # [foo=bar] Default parameter value
6165+
\s*
6166+
(
6167+
# The inner regexes are to stop the match early at */ and to not stop at escaped quotes
6168+
(?:
6169+
"(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted
6170+
'(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted
6171+
\[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal
6172+
(?:(?:\*(?!/))|[^*])*? # Everything else
6173+
)*
6174+
)
6175+
)?
6176+
\s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/))</string>
6177+
<key>captures</key>
6178+
<dict>
6179+
<key>1</key>
6180+
<dict>
6181+
<key>name</key>
6182+
<string>punctuation.definition.optional-value.begin.bracket.square.jsdoc</string>
6183+
</dict>
6184+
<key>2</key>
6185+
<dict>
6186+
<key>name</key>
6187+
<string>keyword.operator.assignment.jsdoc</string>
6188+
</dict>
6189+
<key>3</key>
6190+
<dict>
6191+
<key>name</key>
6192+
<string>source.embedded.ts</string>
6193+
</dict>
6194+
<key>4</key>
6195+
<dict>
6196+
<key>name</key>
6197+
<string>punctuation.definition.optional-value.end.bracket.square.jsdoc</string>
6198+
</dict>
6199+
<key>5</key>
6200+
<dict>
6201+
<key>name</key>
6202+
<string>invalid.illegal.syntax.jsdoc</string>
6203+
</dict>
6204+
</dict>
61456205
<key>begin</key>
61466206
<string>\[</string>
61476207
<key>end</key>
@@ -6307,7 +6367,7 @@
63076367
<key>name</key>
63086368
<string>storage.type.class.jsdoc</string>
63096369
<key>match</key>
6310-
<string>(?x) (@) (?:abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface|kind |lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module|name|namespace |noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve|private|prop |property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule |summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce) \b</string>
6370+
<string>(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface |internal|kind|lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module |name|namespace|noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve |private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static |struct|submodule|summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted |uses|var|variation|version|virtual|writeOnce) \b</string>
63116371
<key>captures</key>
63126372
<dict>
63136373
<key>1</key>

TypeScriptReact.tmLanguage

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5692,7 +5692,7 @@
56925692
<dict>
56935693
<key>match</key>
56945694
<string>(?x)
5695-
((@)access)
5695+
((@)(?:access|api))
56965696
\s+
56975697
(private|protected|public)
56985698
\b</string>
@@ -5914,7 +5914,15 @@
59145914
(?:
59155915
# URL
59165916
(
5917-
(?=https?://)
5917+
(?!
5918+
# Avoid matching bare URIs (also acceptable as links)
5919+
https?://
5920+
|
5921+
# Avoid matching {@inline tags}; we match those below
5922+
(?:\[[^\[\]]*\])? # Possible description [preceding]{@tag}
5923+
{@(?:link|linkcode|linkplain|tutorial)\b
5924+
)
5925+
# Matched namepath
59185926
(?:[^\s*]|\*[^/])+
59195927
)
59205928
|
@@ -6088,6 +6096,58 @@
60886096
<dict>
60896097
<key>name</key>
60906098
<string>variable.other.jsdoc</string>
6099+
<key>match</key>
6100+
<string>(?x)
6101+
(\[)\s*
6102+
[\w$]+
6103+
(?:
6104+
(?:\[\])? # Foo[ ].bar properties within an array
6105+
\. # Foo.Bar namespaced parameter
6106+
[\w$]+
6107+
)*
6108+
(?:
6109+
\s*
6110+
(=) # [foo=bar] Default parameter value
6111+
\s*
6112+
(
6113+
# The inner regexes are to stop the match early at */ and to not stop at escaped quotes
6114+
(?:
6115+
"(?:(?:\*(?!/))|(?:\\(?!"))|[^*\\])*?" | # [foo="bar"] Double-quoted
6116+
'(?:(?:\*(?!/))|(?:\\(?!'))|[^*\\])*?' | # [foo='bar'] Single-quoted
6117+
\[ (?:(?:\*(?!/))|[^*])*? \] | # [foo=[1,2]] Array literal
6118+
(?:(?:\*(?!/))|[^*])*? # Everything else
6119+
)*
6120+
)
6121+
)?
6122+
\s*(?:(\])((?:[^*\s]|\*[^\s/])+)?|(?=\*/))</string>
6123+
<key>captures</key>
6124+
<dict>
6125+
<key>1</key>
6126+
<dict>
6127+
<key>name</key>
6128+
<string>punctuation.definition.optional-value.begin.bracket.square.jsdoc</string>
6129+
</dict>
6130+
<key>2</key>
6131+
<dict>
6132+
<key>name</key>
6133+
<string>keyword.operator.assignment.jsdoc</string>
6134+
</dict>
6135+
<key>3</key>
6136+
<dict>
6137+
<key>name</key>
6138+
<string>source.embedded.tsx</string>
6139+
</dict>
6140+
<key>4</key>
6141+
<dict>
6142+
<key>name</key>
6143+
<string>punctuation.definition.optional-value.end.bracket.square.jsdoc</string>
6144+
</dict>
6145+
<key>5</key>
6146+
<dict>
6147+
<key>name</key>
6148+
<string>invalid.illegal.syntax.jsdoc</string>
6149+
</dict>
6150+
</dict>
60916151
<key>begin</key>
60926152
<string>\[</string>
60936153
<key>end</key>
@@ -6253,7 +6313,7 @@
62536313
<key>name</key>
62546314
<string>storage.type.class.jsdoc</string>
62556315
<key>match</key>
6256-
<string>(?x) (@) (?:abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface|kind |lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module|name|namespace |noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve|private|prop |property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule |summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation |version|virtual|writeOnce) \b</string>
6316+
<string>(?x) (@) (?:abstract|access|alias|api|arg|argument|async|attribute|augments|author|beta|borrows|bubbles |callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright |default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exception |exports?|extends|extension(?:_?for)?|external|externs|file|fileoverview|final|fires|for|func |function|global|host|ignore|implements|implicitCast|inherit[Dd]oc|inner|instance|interface |internal|kind|lends|license|listens|main|member|memberof!?|method|mixes|mixins?|modifies|module |name|namespace|noalias|nocollapse|nocompile|nosideeffects|override|overview|package|param|preserve |private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static |struct|submodule|summary|suppress|template|this|throws|todo|tutorial|type|typedef|unrestricted |uses|var|variation|version|virtual|writeOnce) \b</string>
62576317
<key>captures</key>
62586318
<dict>
62596319
<key>1</key>

tests/baselines/Issue250.baseline.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,14 @@ Grammar: TypeScript.tmLanguage
6868
source.ts meta.class.ts
6969
^^^
7070
source.ts meta.class.ts comment.block.documentation.ts punctuation.definition.comment.ts
71-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71+
^
7272
source.ts meta.class.ts comment.block.documentation.ts
73+
^
74+
source.ts meta.class.ts comment.block.documentation.ts storage.type.class.jsdoc punctuation.definition.block.tag.jsdoc
75+
^^^^^^^^
76+
source.ts meta.class.ts comment.block.documentation.ts storage.type.class.jsdoc
77+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78+
source.ts meta.class.ts comment.block.documentation.ts
7379
^^
7480
source.ts meta.class.ts comment.block.documentation.ts punctuation.definition.comment.ts
7581
^^

tests/baselines/Issue276.baseline.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ Grammar: TypeScript.tmLanguage
8181
^
8282
source.ts comment.block.documentation.ts
8383
^
84-
source.ts comment.block.documentation.ts variable.other.jsdoc
84+
source.ts comment.block.documentation.ts variable.other.jsdoc punctuation.definition.optional-value.begin.bracket.square.jsdoc
8585
^^^^^^^^^^^^^
8686
source.ts comment.block.documentation.ts variable.other.jsdoc
8787
^
88-
source.ts comment.block.documentation.ts variable.other.jsdoc
88+
source.ts comment.block.documentation.ts variable.other.jsdoc punctuation.definition.optional-value.end.bracket.square.jsdoc
8989
^^
9090
source.ts comment.block.documentation.ts
9191
> */

0 commit comments

Comments
 (0)