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

Commit

Permalink
Merge pull request #115 from atom/wl-comments-in-new
Browse files Browse the repository at this point in the history
Match comments in `new` statements
  • Loading branch information
50Wliu committed Oct 25, 2017
2 parents 70c5724 + 7eca14a commit 49e168b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions grammars/java.cson
Expand Up @@ -172,6 +172,9 @@
'name': 'keyword.control.new.java'
'end': '(?=;|\\)|,|:|}|\\+)'
'patterns': [
{
'include': '#comments'
}
{
'include': '#function-call'
}
Expand Down
8 changes: 8 additions & 0 deletions spec/java-spec.coffee
Expand Up @@ -1081,6 +1081,14 @@ describe 'Java grammar', ->
expect(tokens[15]).toEqual value: '"', scopes: ['source.java', 'meta.method-call.java', 'string.quoted.double.java', 'punctuation.definition.string.begin.java']
expect(tokens[18]).toEqual value: ')', scopes: ['source.java', 'meta.method-call.java', 'punctuation.definition.parameters.end.bracket.round.java']

{tokens} = grammar.tokenizeLine 'new /* JPanel() */ Point();'

expect(tokens[0]).toEqual value: 'new', scopes: ['source.java', 'keyword.control.new.java']
expect(tokens[2]).toEqual value: '/*', scopes: ['source.java', 'comment.block.java', 'punctuation.definition.comment.java']
expect(tokens[4]).toEqual value: '*/', scopes: ['source.java', 'comment.block.java', 'punctuation.definition.comment.java']
expect(tokens[6]).toEqual value: 'Point', scopes: ['source.java', 'meta.function-call.java', 'entity.name.function.java']
expect(tokens[9]).toEqual value: ';', scopes: ['source.java', 'punctuation.terminator.java']

lines = grammar.tokenizeLines '''
map.put(key,
new Value(value)
Expand Down

0 comments on commit 49e168b

Please sign in to comment.