Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions grammars/elixir.cson
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,11 @@
'name': 'constant.other.symbol.elixir'
}
{
'captures':
'1':
'begin': '#'
'beginCaptures':
'0':
'name': 'punctuation.definition.comment.elixir'
'match': '(?:^[ \\t]+)?(#).*$\\n?'
'end': '\\n'
'name': 'comment.line.number-sign.elixir'
}
{
Expand Down Expand Up @@ -706,11 +707,15 @@
]
}
{
'captures':
'begin': '(?<=^|\\s)(#)\\s(?=[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$)'
'beginCaptures':
'1':
'name': 'punctuation.definition.comment.elixir'
'comment': 'We are restrictive in what we allow to go after the comment character to avoid false positives, since the availability of comments depend on regexp flags.'
'match': '(?<=^|\\s)(#)\\s[[a-zA-Z0-9,. \\t?!-][^\\x{00}-\\x{7F}]]*$'
'end': '$\\n?'
'endCaptures':
'0':
'name': 'punctuation.definition.comment.elixir'
'name': 'comment.line.number-sign.elixir'
}
]
Expand Down
5 changes: 5 additions & 0 deletions spec/elixir-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,8 @@ describe "Elixir grammar", ->
expect(tokens[1]).toEqual value: ':', scopes: ['source.elixir', 'constant.other.symbol.elixir', 'punctuation.definition.constant.elixir']
expect(tokens[3]).toEqual value: ':', scopes: ['source.elixir', 'constant.other.symbol.elixir', 'punctuation.definition.constant.elixir']
expect(tokens[4]).toEqual value: 'erlang', scopes: ['source.elixir', 'constant.other.symbol.elixir']

it "tokenizes comments", ->
{tokens} = grammar.tokenizeLine("# TODO: stuff")
expect(tokens[0]).toEqual value: '#', scopes: ['source.elixir', 'comment.line.number-sign.elixir', 'punctuation.definition.comment.elixir']
expect(tokens[1]).toEqual value: ' TODO: stuff', scopes: ['source.elixir', 'comment.line.number-sign.elixir']