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

Commit

Permalink
Stop arguments on all three brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
50Wliu committed Oct 30, 2017
1 parent 2b50d9e commit a0da2a7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
6 changes: 3 additions & 3 deletions grammars/coffeescript.cson
Expand Up @@ -493,7 +493,7 @@
}
{
'begin': '(?=(@|@?[\\w$]+|[=-]>|\\-\\d|\\[|{|\"|\'))'
'end': '(?=\\s*(?<![\\w$])(of|in|then|is|isnt|and|or|for|else|when|if|unless|by|instanceof)(?![\\w$]))|(?=\\s*(}|\\)|#|$))'
'end': '(?=\\s*(?<![\\w$])(of|in|then|is|isnt|and|or|for|else|when|if|unless|by|instanceof)(?![\\w$]))|(?=\\s*(}|\\]|\\)|#|$))'
'name': 'meta.arguments.coffee'
'patterns': [
{
Expand Down Expand Up @@ -566,7 +566,7 @@
'include': '#function_names'
}
]
'end': '(?=\\s*(?<![\\w$])(of|in|then|is|isnt|and|or|for|else|when|if|unless|by|instanceof)(?![\\w$]))|(?=\\s*(}|\\)|#|$))'
'end': '(?=\\s*(?<![\\w$])(of|in|then|is|isnt|and|or|for|else|when|if|unless|by|instanceof)(?![\\w$]))|(?=\\s*(}|\\]|\\)|#|$))'
'name': 'meta.function-call.coffee'
'patterns': [
{
Expand Down Expand Up @@ -700,7 +700,7 @@
'include': '#method_names'
}
]
'end': '(?=\\s*(?<![\\w$])(of|in|then|is|isnt|and|or|for|else|when|if|unless|by|instanceof)(?![\\w$]))|(?=\\s*(}|\\)|#|$))'
'end': '(?=\\s*(?<![\\w$])(of|in|then|is|isnt|and|or|for|else|when|if|unless|by|instanceof)(?![\\w$]))|(?=\\s*(}|\\]|\\)|#|$))'
'name': 'meta.method-call.coffee'
'patterns': [
{
Expand Down
15 changes: 15 additions & 0 deletions spec/coffee-script-spec.coffee
Expand Up @@ -706,6 +706,12 @@ describe "CoffeeScript grammar", ->
expect(tokens[11]).toEqual value: "foods", scopes: ["source.coffee", "meta.function-call.coffee", "meta.arguments.coffee"]
expect(tokens[12]).toEqual value: ")", scopes: ["source.coffee", "meta.brace.round.coffee"]

{tokens} = grammar.tokenizeLine("[eat food]")
expect(tokens[0]).toEqual value: "[", scopes: ["source.coffee", "punctuation.definition.array.begin.bracket.square.coffee"]
expect(tokens[1]).toEqual value: "eat", scopes: ["source.coffee", "meta.function-call.coffee", "entity.name.function.coffee"]
expect(tokens[3]).toEqual value: "food", scopes: ["source.coffee", "meta.function-call.coffee", "meta.arguments.coffee"]
expect(tokens[4]).toEqual value: "]", scopes: ["source.coffee", "punctuation.definition.array.end.bracket.square.coffee"]

{tokens} = grammar.tokenizeLine("foo @bar")
expect(tokens[0]).toEqual value: "foo", scopes: ["source.coffee", "meta.function-call.coffee", "entity.name.function.coffee"]
expect(tokens[2]).toEqual value: "@bar", scopes: ["source.coffee", "meta.function-call.coffee", "meta.arguments.coffee", "variable.other.readwrite.instance.coffee"]
Expand Down Expand Up @@ -969,6 +975,15 @@ describe "CoffeeScript grammar", ->
expect(tokens[5]).toEqual value: 'c', scopes: ['source.coffee', 'meta.method-call.coffee', 'meta.arguments.coffee']
expect(tokens[6]).toEqual value: ')', scopes: ['source.coffee', 'meta.brace.round.coffee']

{tokens} = grammar.tokenizeLine("[a.b c]")
expect(tokens[0]).toEqual value: "[", scopes: ["source.coffee", "punctuation.definition.array.begin.bracket.square.coffee"]
expect(tokens[1]).toEqual value: 'a', scopes: ['source.coffee', 'variable.other.object.coffee']
expect(tokens[2]).toEqual value: '.', scopes: ['source.coffee', 'meta.method-call.coffee', 'punctuation.separator.method.period.coffee']
expect(tokens[3]).toEqual value: 'b', scopes: ['source.coffee', 'meta.method-call.coffee', 'entity.name.function.coffee']
expect(tokens[4]).toEqual value: ' ', scopes: ['source.coffee', 'meta.method-call.coffee']
expect(tokens[5]).toEqual value: 'c', scopes: ['source.coffee', 'meta.method-call.coffee', 'meta.arguments.coffee']
expect(tokens[6]).toEqual value: "]", scopes: ["source.coffee", "punctuation.definition.array.end.bracket.square.coffee"]

{tokens} = grammar.tokenizeLine('a.b not c')
expect(tokens[0]).toEqual value: 'a', scopes: ['source.coffee', 'variable.other.object.coffee']
expect(tokens[1]).toEqual value: '.', scopes: ['source.coffee', 'meta.method-call.coffee', 'punctuation.separator.method.period.coffee']
Expand Down

0 comments on commit a0da2a7

Please sign in to comment.