Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 6634701

Browse files
author
Wliu
authored
Merge pull request #403 from bgriffith/feature/jsdoc
Add JSDoc support for square brackets suffix in types
2 parents 8757a80 + 8b64904 commit 6634701

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Diff for: grammars/javascript.cson

+1-1
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@
16051605
'name': 'storage.type.class.jsdoc'
16061606
}
16071607
{
1608-
'match': '({(?:\\*|(?:\\?|\\!|\\.{3})?[a-zA-Z_$][\\w$]*(?:\\.[a-zA-Z_$][\\w$]*)*=?)})\\s+(\\[(?:[a-zA-Z_$]+(?:=[\\w][\\s\\w$]*)?)\\]|(?:[a-zA-Z_$][\\w$]*(?:\\.[a-zA-Z_$][\\w$]*)*))\\s*((?:(?!\\*\\/).)*)'
1608+
'match': '({(?:\\*|(?:\\?|\\!|\\.{3})?[a-zA-Z_$][\\w$]*(?:\\.[a-zA-Z_$][\\w$]*)*(?:\\[\\])?=?)})\\s+(\\[(?:[a-zA-Z_$]+(?:=[\\w][\\s\\w$]*)?)\\]|(?:[a-zA-Z_$][\\w$]*(?:\\.[a-zA-Z_$][\\w$]*)*))\\s*((?:(?!\\*\\/).)*)'
16091609
'captures':
16101610
0:
16111611
'name': 'other.meta.jsdoc'

Diff for: spec/javascript-spec.coffee

+5
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,11 @@ describe "Javascript grammar", ->
15591559
expect(tokens[6]).toEqual value: 'variable', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
15601560
expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
15611561

1562+
{tokens} = grammar.tokenizeLine('/** @param {number[]} variable this is the description */')
1563+
expect(tokens[4]).toEqual value: '{number[]}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
1564+
expect(tokens[6]).toEqual value: 'variable', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
1565+
expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
1566+
15621567
it "tokenizes // comments", ->
15631568
{tokens} = grammar.tokenizeLine('// comment')
15641569
expect(tokens[0]).toEqual value: '//', scopes: ['source.js', 'comment.line.double-slash.js', 'punctuation.definition.comment.js']

0 commit comments

Comments
 (0)