@@ -305,6 +305,18 @@ describe "JavaScript grammar", ->
305305 expect ( tokens [ 1 ] ) . toEqual value: '...' , scopes : [ 'source.js' , 'keyword.operator.spread.js' ]
306306 expect ( tokens [ 2 ] ) . toEqual value: 'iterableObj' , scopes : [ 'source.js' ]
307307
308+ { tokens } = grammar . tokenizeLine ( '...arguments' )
309+ expect ( tokens [ 0 ] ) . toEqual value: '...' , scopes : [ 'source.js' , 'keyword.operator.spread.js' ]
310+ expect ( tokens [ 1 ] ) . toEqual value: 'arguments' , scopes : [ 'source.js' , 'variable.language.js' ]
311+
312+ { tokens } = grammar . tokenizeLine ( '...super' )
313+ expect ( tokens [ 0 ] ) . toEqual value: '...' , scopes : [ 'source.js' , 'keyword.operator.spread.js' ]
314+ expect ( tokens [ 1 ] ) . toEqual value: 'super' , scopes : [ 'source.js' , 'variable.language.js' ]
315+
316+ { tokens } = grammar . tokenizeLine ( '...this' )
317+ expect ( tokens [ 0 ] ) . toEqual value: '...' , scopes : [ 'source.js' , 'keyword.operator.spread.js' ]
318+ expect ( tokens [ 1 ] ) . toEqual value: 'this' , scopes : [ 'source.js' , 'variable.language.js' ]
319+
308320 describe "increment, decrement" , - >
309321 it "tokenizes increment" , - >
310322 { tokens} = grammar . tokenizeLine ( 'i++' )
@@ -2063,6 +2075,54 @@ describe "JavaScript grammar", ->
20632075 expect(tokens[6]).toEqual value: "[ variable = ' default value ' ]", scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
20642076 expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
20652077
2078+ {tokens} = grammar.tokenizeLine('/** @param {Object} [variable={a: "b"}] - An object */')
2079+ expect(tokens[4]).toEqual value: '{Object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2080+ expect(tokens[6]).toEqual value: '[variable={a: "b"}]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2081+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2082+ expect(tokens[8]).toEqual value: 'An object ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2083+
2084+ {tokens} = grammar.tokenizeLine('/** @param {Object} [ variable = { a : "b" } ] - An object */')
2085+ expect(tokens[4]).toEqual value: '{Object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2086+ expect(tokens[6]).toEqual value: '[ variable = { a : "b" } ]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2087+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2088+ expect(tokens[8]).toEqual value: 'An object ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2089+
2090+ {tokens} = grammar.tokenizeLine('/** @param {Array} [variable=[1,2,3]] - An array */')
2091+ expect(tokens[4]).toEqual value: '{Array}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2092+ expect(tokens[6]).toEqual value: '[variable=[1,2,3]]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2093+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2094+ expect(tokens[8]).toEqual value: 'An array ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2095+
2096+ {tokens} = grammar.tokenizeLine('/** @param {Array} [ variable = [ 1 , 2 , 3 ] ] - An array */')
2097+ expect(tokens[4]).toEqual value: '{Array}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2098+ expect(tokens[6]).toEqual value: '[ variable = [ 1 , 2 , 3 ] ]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2099+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2100+ expect(tokens[8]).toEqual value: 'An array ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2101+
2102+ {tokens} = grammar.tokenizeLine('/** @param {Object} [variable={}] - Empty object */')
2103+ expect(tokens[4]).toEqual value: '{Object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2104+ expect(tokens[6]).toEqual value: '[variable={}]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2105+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2106+ expect(tokens[8]).toEqual value: 'Empty object ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2107+
2108+ {tokens} = grammar.tokenizeLine('/** @param {Object} [ variable = { } ] - Empty object */')
2109+ expect(tokens[4]).toEqual value: '{Object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2110+ expect(tokens[6]).toEqual value: '[ variable = { } ]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2111+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2112+ expect(tokens[8]).toEqual value: 'Empty object ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2113+
2114+ {tokens} = grammar.tokenizeLine('/** @param {Array} [variable=[]] - Empty array */')
2115+ expect(tokens[4]).toEqual value: '{Array}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2116+ expect(tokens[6]).toEqual value: '[variable=[]]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2117+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2118+ expect(tokens[8]).toEqual value: 'Empty array ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2119+
2120+ {tokens} = grammar.tokenizeLine('/** @param {Array} [ variable = [ ] ] - Empty array */')
2121+ expect(tokens[4]).toEqual value: '{Array}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2122+ expect(tokens[6]).toEqual value: '[ variable = [ ] ]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2123+ expect(tokens[7]).toEqual value: ' - ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc']
2124+ expect(tokens[8]).toEqual value: 'Empty array ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2125+
20662126 {tokens} = grammar.tokenizeLine('/** @param {object} variable - this is a {@link linked} description */')
20672127 expect(tokens[6]).toEqual value: 'variable', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
20682128 expect(tokens[8]).toEqual value: 'this is a ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
@@ -2182,6 +2242,16 @@ describe "JavaScript grammar", ->
21822242 expect(tokens[6]).toEqual value: 'variable', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
21832243 expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
21842244
2245+ {tokens} = grammar.tokenizeLine('/** @param {...*} remainder */')
2246+ expect(tokens[2]).toEqual value: '@param', scopes: ['source.js', 'comment.block.documentation.js', 'storage.type.class.jsdoc']
2247+ expect(tokens[4]).toEqual value: '{...*}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2248+ expect(tokens[6]).toEqual value: 'remainder', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2249+
2250+ {tokens} = grammar.tokenizeLine('/** @param {...?} remainder */')
2251+ expect(tokens[2]).toEqual value: '@param', scopes: ['source.js', 'comment.block.documentation.js', 'storage.type.class.jsdoc']
2252+ expect(tokens[4]).toEqual value: '{...?}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2253+ expect(tokens[6]).toEqual value: 'remainder', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2254+
21852255 {tokens} = grammar.tokenizeLine('/** @param {number=} variable this is the description */')
21862256 expect(tokens[4]).toEqual value: '{number=}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
21872257 expect(tokens[6]).toEqual value: 'variable', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
@@ -2339,6 +2409,14 @@ describe "JavaScript grammar", ->
23392409 {tokens} = grammar.tokenizeLine('/** @return {Some|Thing} Something to return */')
23402410 expect(tokens[4]).toEqual value: '{Some|Thing}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
23412411
2412+ {tokens} = grammar.tokenizeLine('/** @return {(String[]|Number[])} Description */')
2413+ expect(tokens[4]).toEqual value: '{(String[]|Number[])}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2414+ expect(tokens[6]).toEqual value: 'Description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']
2415+
2416+ {tokens} = grammar.tokenizeLine('/** @param {(Number|Number[])} Numbers */')
2417+ expect(tokens[4]).toEqual value: '{(Number|Number[])}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
2418+ expect(tokens[6]).toEqual value: 'Numbers', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
2419+
23422420 {tokens} = grammar.tokenizeLine('/** @return {object} */')
23432421 expect(tokens[4]).toEqual value: '{object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
23442422
0 commit comments