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

Add support for namespaced default values #482

Merged
merged 1 commit into from Jan 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions grammars/javascript.cson
Expand Up @@ -2062,10 +2062,10 @@
= # [foo=bar] Default parameter value
\\s*
(?:
[\\w$\\s]* | # [foo=bar] Unquoted
"[^"]*" | # [foo="bar"] Double-quoted
'[^']*' | # [foo='bar'] Single-quoted
{[^{}]*} | # [foo={a:1}] Object literal
[\\w$.\\s]* | # [foo=bar] Unquoted
"[^"]*" | # [foo="bar"] Double-quoted
'[^']*' | # [foo='bar'] Single-quoted
{[^{}]*} | # [foo={a:1}] Object literal
\\[ [^\\[\\]]* \\] # [foo=[1,2]] Array literal
)
)?
Expand Down
5 changes: 5 additions & 0 deletions spec/javascript-spec.coffee
Expand Up @@ -1853,6 +1853,11 @@ describe "JavaScript grammar", ->
expect(tokens[6]).toEqual value: '[ variable = default value ]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']

{tokens} = grammar.tokenizeLine '/** @param {object} [variable=default.value] this is the description */'
expect(tokens[4]).toEqual value: '{object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
expect(tokens[6]).toEqual value: '[variable=default.value]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
expect(tokens[8]).toEqual value: 'this is the description ', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'other.description.jsdoc']

{tokens} = grammar.tokenizeLine('/** @param {object} [variable="default value"] this is the description */')
expect(tokens[4]).toEqual value: '{object}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc']
expect(tokens[6]).toEqual value: '[variable="default value"]', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'variable.other.jsdoc']
Expand Down