Skip to content

Commit

Permalink
Fixes #164 flow comment syntax breaks highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
gandm committed Apr 14, 2016
1 parent ae4f42f commit 609f5e7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
### 2.17.2
- [Fixes #164](https://github.com/gandm/language-babel/issues/164) flow comment syntax breaks highlighting

### 2.17.1
- Fix regression: single line comment not including language-todo
- Fix export default <jsx></jsx> in grammar

#### 2.17.0
- Add file tree `Babel Transpile` context menu. [Enhancement Request #160](https://github.com/gandm/language-babel/issues/160)
- Add `.es` as grammar detected file type.
Expand Down
1 change: 1 addition & 0 deletions grammars/Babel Language.json
Original file line number Diff line number Diff line change
Expand Up @@ -1635,6 +1635,7 @@
},
"flowtype": {
"patterns": [
{ "include": "#comments" },
{ "include": "#flowtype-polymorphs" },
{ "include": "#flowtype-bracketed-parameters" },
{ "include": "#flowtype-return" }
Expand Down
37 changes: 37 additions & 0 deletions spec/fixtures/grammar/issues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// SYNTAX TEST "source.js.jsx"

const foo = function foo(a /* : string*/) /* {[key: string]: string} */ {
// <- storage.type.js
// <- storage.type.js
//^^^ storage.type.js
// ^^^ ^ ^^^^^^^^ ^^^^^ ^^ ^ ^^^^^^^^^ ^^ ^^^^^^ ^^^^^^^^ ^^^^^^^ ^^ meta.function.js
// ^^^ ^^^ entity.name.function.js
// ^ keyword.operator.assignment.js
// ^^^^^^^^ storage.type.function.js
// ^ punctuation.definition.parameters.begin.js
// ^ variable.other.readwrite.js
// ^^ ^ ^^^^^^^^ ^^ ^^^^^^ ^^^^^^^^ ^^^^^^^ ^^ comment.block.js
// ^^ ^^ ^^ ^^ punctuation.definition.comment.js
// ^ punctuation.definition.parameters.end.js
// ^ meta.group.braces.curly
// ^ meta.brace.curly.js
return {
//^^^^^^ ^ meta.group.braces.curly
//^^^^^^ keyword.control.flow.js
// ^ meta.brace.curly.js
bar
// ^^^ meta.group.braces.curly
// ^^^ variable.other.readwrite.js
}
//^ meta.group.braces.curly
//^ meta.brace.curly.js
}
// <- meta.group.braces.curly meta.brace.curly.js

module.exports = exports = foo
// <- support.type.object.module.js keyword.operator.accessor.js
// <- support.type.object.module.js keyword.operator.accessor.js
//^^^^^^^^^^^^ ^^^^^^^ support.type.object.module.js
//^^^^^^^^^^^^ ^^^^^^^ keyword.operator.accessor.js
// ^ ^ keyword.operator.assignment.js
// ^^^ variable.other.readwrite.js
3 changes: 3 additions & 0 deletions spec/grammar-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ describe 'Grammar', ->

# todo,jsdoc,...
grammarTest path.join(__dirname, 'fixtures/grammar/doc-keywords.js')

# issues raised
grammarTest path.join(__dirname, 'fixtures/grammar/issues.js')

0 comments on commit 609f5e7

Please sign in to comment.