Update jsdoc type and variable recognition

Fixes #276
This commit is contained in:
Sheetal Nandi 2016-09-29 14:41:22 -07:00
Родитель 01b3bf11c2
Коммит 52bb30d79b
7 изменённых файлов: 865 добавлений и 286 удалений

Просмотреть файл

@ -1597,42 +1597,6 @@ repository:
patterns:
- include: '#expression'
comment:
patterns:
- name: comment.block.documentation.ts
begin: /\*\*(?!/)
end: \*/
captures:
'0': {name: punctuation.definition.comment.ts}
patterns:
- include: '#docblock'
- name: comment.block.ts
begin: /\*
end: \*/
captures:
'0': {name: punctuation.definition.comment.ts}
- begin: (^[ \t]+)?(?=//)
beginCaptures:
'1': {name: punctuation.whitespace.comment.leading.ts}
end: (?=$)
patterns:
- name: comment.line.double-slash.ts
begin: //
beginCaptures:
'0': {name: punctuation.definition.comment.ts}
end: (?=$)
docblock:
patterns:
- name: storage.type.class.jsdoc
match: (?<!\w)@(abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file|fileoverview|final|fires|for|function|global|host|ignore|implements|inherit[Dd]oc|inner|instance|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|module|name|namespace|nocollapse|nosideeffects|override|overview|package|param|preserve|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b
- match: ({\b(?:[_$[:alpha:]][_$[:alnum:]]*)\b})\s+\b([_$[:alpha:]][_$[:alnum:]]*)\b\s*((?:(?!\*\/).)*)
captures:
'0': {name: other.meta.jsdoc}
'1': {name: entity.name.type.instance.jsdoc}
'2': {name: variable.other.jsdoc}
'3': {name: other.description.jsdoc}
literal:
name: literal.ts
patterns:
@ -1728,4 +1692,179 @@ repository:
name: storage.type.property.ts
match: (?<!\.|\$)\b(get|set)\b(?!\$)
comment:
patterns:
- name: comment.block.documentation.ts
begin: /\*\*(?!/)
end: \*/
captures:
'0': {name: punctuation.definition.comment.ts}
patterns:
- include: '#docblock'
- name: comment.block.ts
begin: /\*
end: \*/
captures:
'0': {name: punctuation.definition.comment.ts}
- begin: (^[ \t]+)?(?=//)
beginCaptures:
'1': {name: punctuation.whitespace.comment.leading.ts}
end: (?=$)
patterns:
- name: comment.line.double-slash.ts
begin: //
beginCaptures:
'0': {name: punctuation.definition.comment.ts}
end: (?=$)
docblock:
patterns:
- name: storage.type.class.jsdoc
match: (?<!\w)@(abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file|fileoverview|final|fires|for|function|global|host|ignore|implements|inherit[Dd]oc|inner|instance|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|module|name|namespace|nocollapse|nosideeffects|override|overview|package|param|preserve|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b
- match: |-
(?x)
(?:(?<=@param)|(?<=@type))
\s+
({(?:
\* | # {*} any type
\? | # {?} unknown type
(?: # Check for a prefix
\? | # {?string} nullable type
! | # {!string} non-nullable type
\.{3} # {...string} variable number of parameters
)?
(?:
\( # Opening bracket of multiple types with parenthesis {(string|number)}
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {(string[]|number)} type application, an array of strings or a number
) |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {(string|number[])} type application, a string or an array of numbers
) |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
)*
\) |
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {string[]|number} type application, an array of strings or a number
) |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
)*
)
# Check for suffix
(?:\[\])? # {string[]} type application, an array of strings
=? # {string=} optional parameter
)})
\s+
(
\[ # [foo] optional parameter
\s*
(?:
[a-zA-Z_$][\w$]*
(?:
(?:\[\])? # Foo[].bar properties within an array
\. # Foo.Bar namespaced parameter
[a-zA-Z_$][\w$]*
)*
(?:
\s*
= # [foo=bar] Default parameter value
\s*
[\w$\s]*
)?
)
\s*
\] |
(?:
[a-zA-Z_$][\w$]*
(?:
(?:\[\])? # Foo[].bar properties within an array
\. # Foo.Bar namespaced parameter
[a-zA-Z_$][\w$]*
)*
)?
)
\s+
((?:(?!\*\/).)*) # The type description
captures:
'0': { name: other.meta.jsdoc }
'1': { name: entity.name.type.instance.jsdoc }
'2': { name: variable.other.jsdoc }
'3': { name: other.description.jsdoc }
- match: |-
(?x)
({(?:
\* | # {*} any type
\? | # {?} unknown type
(?: # Check for a prefix
\? | # {?string} nullable type
! | # {!string} non-nullable type
\.{3} # {...string} variable number of parameters
)?
(?:
\( # Opening bracket of multiple types with parenthesis {(string|number)}
[a-zA-Z_$]+
(?:
[\w$]* |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
)*
\) |
[a-zA-Z_$]+
(?:
[\w$]* |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
<[\w$]+(?:,\s+[\w$]+)*> # {Array<string>} or {Object<string, number>} type application
)
)*
)
# Check for suffix
(?:\[\])? # {string[]} type application, an array of strings
=? # {string=} optional parameter
)})
\s+
((?:(?!\*\/).)*) # The type description
captures:
'0': { name: other.meta.jsdoc }
'1': { name: entity.name.type.instance.jsdoc }
'2': { name: other.description.jsdoc }
...

Просмотреть файл

@ -4502,123 +4502,6 @@
</dict>
</array>
</dict>
<key>comment</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.block.documentation.ts</string>
<key>begin</key>
<string>/\*\*(?!/)</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.ts</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#docblock</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>comment.block.ts</string>
<key>begin</key>
<string>/\*</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.ts</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>(^[ \t]+)?(?=//)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.whitespace.comment.leading.ts</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.line.double-slash.ts</string>
<key>begin</key>
<string>//</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.ts</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>docblock</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>storage.type.class.jsdoc</string>
<key>match</key>
<string>(?&lt;!\w)@(abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file|fileoverview|final|fires|for|function|global|host|ignore|implements|inherit[Dd]oc|inner|instance|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|module|name|namespace|nocollapse|nosideeffects|override|overview|package|param|preserve|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b</string>
</dict>
<dict>
<key>match</key>
<string>({\b(?:[_$[:alpha:]][_$[:alnum:]]*)\b})\s+\b([_$[:alpha:]][_$[:alnum:]]*)\b\s*((?:(?!\*\/).)*)</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>other.meta.jsdoc</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.type.instance.jsdoc</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.jsdoc</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>other.description.jsdoc</string>
</dict>
</dict>
</dict>
</array>
</dict>
<key>literal</key>
<dict>
<key>name</key>
@ -4856,6 +4739,277 @@
<key>match</key>
<string>(?&lt;!\.|\$)\b(get|set)\b(?!\$)</string>
</dict>
<key>comment</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.block.documentation.ts</string>
<key>begin</key>
<string>/\*\*(?!/)</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.ts</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#docblock</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>comment.block.ts</string>
<key>begin</key>
<string>/\*</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.ts</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>(^[ \t]+)?(?=//)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.whitespace.comment.leading.ts</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.line.double-slash.ts</string>
<key>begin</key>
<string>//</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.ts</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>docblock</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>storage.type.class.jsdoc</string>
<key>match</key>
<string>(?&lt;!\w)@(abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file|fileoverview|final|fires|for|function|global|host|ignore|implements|inherit[Dd]oc|inner|instance|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|module|name|namespace|nocollapse|nosideeffects|override|overview|package|param|preserve|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b</string>
</dict>
<dict>
<key>match</key>
<string>(?x)
(?:(?&lt;=@param)|(?&lt;=@type))
\s+
({(?:
\* | # {*} any type
\? | # {?} unknown type
(?: # Check for a prefix
\? | # {?string} nullable type
! | # {!string} non-nullable type
\.{3} # {...string} variable number of parameters
)?
(?:
\( # Opening bracket of multiple types with parenthesis {(string|number)}
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {(string[]|number)} type application, an array of strings or a number
) |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {(string|number[])} type application, a string or an array of numbers
) |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
\) |
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {string[]|number} type application, an array of strings or a number
) |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
)
# Check for suffix
(?:\[\])? # {string[]} type application, an array of strings
=? # {string=} optional parameter
)})
\s+
(
\[ # [foo] optional parameter
\s*
(?:
[a-zA-Z_$][\w$]*
(?:
(?:\[\])? # Foo[].bar properties within an array
\. # Foo.Bar namespaced parameter
[a-zA-Z_$][\w$]*
)*
(?:
\s*
= # [foo=bar] Default parameter value
\s*
[\w$\s]*
)?
)
\s*
\] |
(?:
[a-zA-Z_$][\w$]*
(?:
(?:\[\])? # Foo[].bar properties within an array
\. # Foo.Bar namespaced parameter
[a-zA-Z_$][\w$]*
)*
)?
)
\s+
((?:(?!\*\/).)*) # The type description</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>other.meta.jsdoc</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.type.instance.jsdoc</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.jsdoc</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>other.description.jsdoc</string>
</dict>
</dict>
</dict>
<dict>
<key>match</key>
<string>(?x)
({(?:
\* | # {*} any type
\? | # {?} unknown type
(?: # Check for a prefix
\? | # {?string} nullable type
! | # {!string} non-nullable type
\.{3} # {...string} variable number of parameters
)?
(?:
\( # Opening bracket of multiple types with parenthesis {(string|number)}
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
\) |
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
)
# Check for suffix
(?:\[\])? # {string[]} type application, an array of strings
=? # {string=} optional parameter
)})
\s+
((?:(?!\*\/).)*) # The type description</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>other.meta.jsdoc</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.type.instance.jsdoc</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>other.description.jsdoc</string>
</dict>
</dict>
</dict>
</array>
</dict>
</dict>
</dict>
</plist>

Просмотреть файл

@ -4484,123 +4484,6 @@
</dict>
</array>
</dict>
<key>comment</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.block.documentation.tsx</string>
<key>begin</key>
<string>/\*\*(?!/)</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.tsx</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#docblock</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>comment.block.tsx</string>
<key>begin</key>
<string>/\*</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.tsx</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>(^[ \t]+)?(?=//)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.whitespace.comment.leading.tsx</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.line.double-slash.tsx</string>
<key>begin</key>
<string>//</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.tsx</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>docblock</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>storage.type.class.jsdoc</string>
<key>match</key>
<string>(?&lt;!\w)@(abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file|fileoverview|final|fires|for|function|global|host|ignore|implements|inherit[Dd]oc|inner|instance|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|module|name|namespace|nocollapse|nosideeffects|override|overview|package|param|preserve|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b</string>
</dict>
<dict>
<key>match</key>
<string>({\b(?:[_$[:alpha:]][_$[:alnum:]]*)\b})\s+\b([_$[:alpha:]][_$[:alnum:]]*)\b\s*((?:(?!\*\/).)*)</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>other.meta.jsdoc</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.type.instance.jsdoc</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.jsdoc</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>other.description.jsdoc</string>
</dict>
</dict>
</dict>
</array>
</dict>
<key>literal</key>
<dict>
<key>name</key>
@ -4838,6 +4721,277 @@
<key>match</key>
<string>(?&lt;!\.|\$)\b(get|set)\b(?!\$)</string>
</dict>
<key>comment</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.block.documentation.tsx</string>
<key>begin</key>
<string>/\*\*(?!/)</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.tsx</string>
</dict>
</dict>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#docblock</string>
</dict>
</array>
</dict>
<dict>
<key>name</key>
<string>comment.block.tsx</string>
<key>begin</key>
<string>/\*</string>
<key>end</key>
<string>\*/</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.tsx</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>(^[ \t]+)?(?=//)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.whitespace.comment.leading.tsx</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>comment.line.double-slash.tsx</string>
<key>begin</key>
<string>//</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.tsx</string>
</dict>
</dict>
<key>end</key>
<string>(?=$)</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>docblock</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>name</key>
<string>storage.type.class.jsdoc</string>
<key>match</key>
<string>(?&lt;!\w)@(abstract|access|alias|arg|argument|async|attribute|augments|author|beta|borrows|bubbes|callback|chainable|class|classdesc|code|config|const|constant|constructor|constructs|copyright|default|defaultvalue|define|deprecated|desc|description|dict|emits|enum|event|example|exports?|extends|extension|extension_for|extensionfor|external|file|fileoverview|final|fires|for|function|global|host|ignore|implements|inherit[Dd]oc|inner|instance|interface|kind|lends|license|listens|main|member|memberof|method|mixex|mixins?|module|name|namespace|nocollapse|nosideeffects|override|overview|package|param|preserve|private|prop|property|protected|public|read[Oo]nly|record|require[ds]|returns?|see|since|static|struct|submodule|summary|template|this|throws|todo|tutorial|type|typedef|unrestricted|uses|var|variation|version|virtual|writeOnce)\b</string>
</dict>
<dict>
<key>match</key>
<string>(?x)
(?:(?&lt;=@param)|(?&lt;=@type))
\s+
({(?:
\* | # {*} any type
\? | # {?} unknown type
(?: # Check for a prefix
\? | # {?string} nullable type
! | # {!string} non-nullable type
\.{3} # {...string} variable number of parameters
)?
(?:
\( # Opening bracket of multiple types with parenthesis {(string|number)}
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {(string[]|number)} type application, an array of strings or a number
) |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {(string|number[])} type application, a string or an array of numbers
) |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
\) |
[a-zA-Z_$]+
(?:
(?:
[\w$]*
(?:\[\])? # {string[]|number} type application, an array of strings or a number
) |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
)
# Check for suffix
(?:\[\])? # {string[]} type application, an array of strings
=? # {string=} optional parameter
)})
\s+
(
\[ # [foo] optional parameter
\s*
(?:
[a-zA-Z_$][\w$]*
(?:
(?:\[\])? # Foo[].bar properties within an array
\. # Foo.Bar namespaced parameter
[a-zA-Z_$][\w$]*
)*
(?:
\s*
= # [foo=bar] Default parameter value
\s*
[\w$\s]*
)?
)
\s*
\] |
(?:
[a-zA-Z_$][\w$]*
(?:
(?:\[\])? # Foo[].bar properties within an array
\. # Foo.Bar namespaced parameter
[a-zA-Z_$][\w$]*
)*
)?
)
\s+
((?:(?!\*\/).)*) # The type description</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>other.meta.jsdoc</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.type.instance.jsdoc</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>variable.other.jsdoc</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>other.description.jsdoc</string>
</dict>
</dict>
</dict>
<dict>
<key>match</key>
<string>(?x)
({(?:
\* | # {*} any type
\? | # {?} unknown type
(?: # Check for a prefix
\? | # {?string} nullable type
! | # {!string} non-nullable type
\.{3} # {...string} variable number of parameters
)?
(?:
\( # Opening bracket of multiple types with parenthesis {(string|number)}
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
\) |
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
(?:
[\.|~] # {Foo.bar} namespaced, {string|number} multiple, {Foo~bar} class-specific callback
[a-zA-Z_$]+
(?:
[\w$]* |
&lt;[\w$]+(?:,\s+[\w$]+)*&gt; # {Array&lt;string&gt;} or {Object&lt;string, number&gt;} type application
)
)*
)
# Check for suffix
(?:\[\])? # {string[]} type application, an array of strings
=? # {string=} optional parameter
)})
\s+
((?:(?!\*\/).)*) # The type description</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>other.meta.jsdoc</string>
</dict>
<key>1</key>
<dict>
<key>name</key>
<string>entity.name.type.instance.jsdoc</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>other.description.jsdoc</string>
</dict>
</dict>
</dict>
</array>
</dict>
<key>jsx-tag-attributes</key>
<dict>
<key>patterns</key>

Просмотреть файл

@ -356,7 +356,7 @@ Grammar: TypeScript.tmLanguage
^^^^^^
source.ts meta.class.ts comment.block.documentation.ts storage.type.class.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
@ -378,12 +378,8 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc variable.other.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc other.description.jsdoc
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc other.description.jsdoc
> */
^^^^^
source.ts meta.class.ts comment.block.documentation.ts
@ -752,7 +748,7 @@ Grammar: TypeScript.tmLanguage
^^^^^^
source.ts meta.class.ts comment.block.documentation.ts storage.type.class.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
@ -774,12 +770,8 @@ Grammar: TypeScript.tmLanguage
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc variable.other.jsdoc
^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc other.description.jsdoc
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
source.ts meta.class.ts comment.block.documentation.ts other.meta.jsdoc other.description.jsdoc
> */
^^^^^
source.ts meta.class.ts comment.block.documentation.ts

Просмотреть файл

@ -0,0 +1,132 @@
original file
-----------------------------------
/**
* @param {string} value
* @param {string[]} arrayValue
* @param {string} [optionalValue]
*/
function test(value: string, arrayValue: string[], optionalValue?: string) {
}
-----------------------------------
Grammar: TypeScript.tmLanguage
-----------------------------------
>/**
^^^
source.ts comment.block.documentation.ts punctuation.definition.comment.ts
^^
source.ts comment.block.documentation.ts
> * @param {string} value
^^^
source.ts comment.block.documentation.ts
^^^^^^
source.ts comment.block.documentation.ts storage.type.class.jsdoc
^
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc variable.other.jsdoc
^^
source.ts comment.block.documentation.ts other.meta.jsdoc
> * @param {string[]} arrayValue
^^^
source.ts comment.block.documentation.ts
^^^^^^
source.ts comment.block.documentation.ts storage.type.class.jsdoc
^
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc variable.other.jsdoc
^^
source.ts comment.block.documentation.ts other.meta.jsdoc
> * @param {string} [optionalValue]
^^^
source.ts comment.block.documentation.ts
^^^^^^
source.ts comment.block.documentation.ts storage.type.class.jsdoc
^
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^^^^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc variable.other.jsdoc
^^
source.ts comment.block.documentation.ts other.meta.jsdoc
> */
^
source.ts comment.block.documentation.ts
^^
source.ts comment.block.documentation.ts punctuation.definition.comment.ts
^^
source.ts
>function test(value: string, arrayValue: string[], optionalValue?: string) {
^^^^^^^^
source.ts meta.function.ts storage.type.function.ts
^
source.ts meta.function.ts
^^^^
source.ts meta.function.ts entity.name.function.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
^^^^^
source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
^^^^^^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts
^^^^^^^^^^
source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
^^^^^^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.tuple.ts meta.brace.square.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts meta.type.tuple.ts meta.brace.square.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.separator.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts
^^^^^^^^^^^^^
source.ts meta.function.ts meta.parameters.ts variable.parameter.ts
^
source.ts meta.function.ts meta.parameters.ts keyword.operator.optional.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts keyword.operator.type.annotation.ts
^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts
^^^^^^
source.ts meta.function.ts meta.parameters.ts meta.type.annotation.ts support.type.primitive.ts
^
source.ts meta.function.ts meta.parameters.ts punctuation.definition.parameters.end.ts
^
source.ts meta.function.ts
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts
^^
source.ts meta.function.ts meta.block.ts
>
^^
source.ts meta.function.ts meta.block.ts
>}
^
source.ts meta.function.ts meta.block.ts punctuation.definition.block.ts

Просмотреть файл

@ -26,7 +26,7 @@ Grammar: TypeScript.tmLanguage
^^^^^^
source.ts comment.block.documentation.ts storage.type.class.jsdoc
^
source.ts comment.block.documentation.ts
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^
@ -43,7 +43,7 @@ Grammar: TypeScript.tmLanguage
^^^^^^
source.ts comment.block.documentation.ts storage.type.class.jsdoc
^
source.ts comment.block.documentation.ts
source.ts comment.block.documentation.ts other.meta.jsdoc
^^^^^^^^
source.ts comment.block.documentation.ts other.meta.jsdoc entity.name.type.instance.jsdoc
^

8
tests/cases/Issue276.ts Normal file
Просмотреть файл

@ -0,0 +1,8 @@
/**
* @param {string} value
* @param {string[]} arrayValue
* @param {string} [optionalValue]
*/
function test(value: string, arrayValue: string[], optionalValue?: string) {
}