From 3d7bfe15c7c0771a7ffe5a03c94d5df92a4c848b Mon Sep 17 00:00:00 2001 From: Ben Griffith Date: Wed, 10 Aug 2016 19:58:05 +0100 Subject: [PATCH 1/4] :bug: Allow for alternative optional JSDoc type syntax --- grammars/javascript.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/javascript.cson b/grammars/javascript.cson index 6ec36c23..ec533af0 100644 --- a/grammars/javascript.cson +++ b/grammars/javascript.cson @@ -1605,7 +1605,7 @@ 'name': 'storage.type.class.jsdoc' } { - '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*((?:(?!\\*\\/).)*)' + '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*((?:(?!\\*\\/).)*)' 'captures': 0: 'name': 'other.meta.jsdoc' From 132dae0a3528a2a28492bb99e98121ba5bef836b Mon Sep 17 00:00:00 2001 From: Ben Griffith Date: Wed, 10 Aug 2016 19:58:35 +0100 Subject: [PATCH 2/4] :white_check_mark: Add spec for alternative optional JSDoc type syntax --- spec/javascript-spec.coffee | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/javascript-spec.coffee b/spec/javascript-spec.coffee index a7d27a70..6edfde8f 100644 --- a/spec/javascript-spec.coffee +++ b/spec/javascript-spec.coffee @@ -1554,6 +1554,11 @@ describe "Javascript grammar", -> expect(tokens[6]).toEqual value: 'variable', 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 {number=} variable this is the description */') + expect(tokens[4]).toEqual value: '{number=}', scopes: ['source.js', 'comment.block.documentation.js', 'other.meta.jsdoc', 'entity.name.type.instance.jsdoc'] + expect(tokens[6]).toEqual value: 'variable', 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'] + it "tokenizes // comments", -> {tokens} = grammar.tokenizeLine('// comment') expect(tokens[0]).toEqual value: '//', scopes: ['source.js', 'comment.line.double-slash.js', 'punctuation.definition.comment.js'] From be8f99f0686c804b1d9a3ff239ab638834e0802f Mon Sep 17 00:00:00 2001 From: Ben Griffith Date: Wed, 10 Aug 2016 21:39:50 +0100 Subject: [PATCH 3/4] :fire: Remove unnecessary escaping slashes on = --- grammars/javascript.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/javascript.cson b/grammars/javascript.cson index ec533af0..675f0259 100644 --- a/grammars/javascript.cson +++ b/grammars/javascript.cson @@ -1605,7 +1605,7 @@ 'name': 'storage.type.class.jsdoc' } { - '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*((?:(?!\\*\\/).)*)' + '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*((?:(?!\\*\\/).)*)' 'captures': 0: 'name': 'other.meta.jsdoc' From 577695bf7013f794a3e0f065d07c0bc49461734c Mon Sep 17 00:00:00 2001 From: Ben Griffith Date: Wed, 10 Aug 2016 21:51:21 +0100 Subject: [PATCH 4/4] :fire: Remove uneccessary non-capture group --- grammars/javascript.cson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grammars/javascript.cson b/grammars/javascript.cson index 675f0259..b81267a7 100644 --- a/grammars/javascript.cson +++ b/grammars/javascript.cson @@ -1605,7 +1605,7 @@ 'name': 'storage.type.class.jsdoc' } { - '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*((?:(?!\\*\\/).)*)' + '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*((?:(?!\\*\\/).)*)' 'captures': 0: 'name': 'other.meta.jsdoc'