Skip to content
Open
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
4 changes: 2 additions & 2 deletions grammars/elixir.cson
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
'begin': '@(module|type)?doc ~S"""'
'comment': '@doc with heredocs is treated as documentation'
'end': '\\s*"""'
'name': 'comment.documentation.heredoc.elixir'
'name': 'comment.documentation.heredoc.literal.elixir'
'patterns': [
{
'include': '#escaped_char'
Expand All @@ -64,7 +64,7 @@
'begin': "@(module|type)?doc ~S'''"
'comment': '@doc with heredocs is treated as documentation'
'end': "\\s*'''"
'name': 'comment.documentation.heredoc.elixir'
'name': 'comment.documentation.heredoc.literal.elixir'
'patterns': [
{
'include': '#escaped_char'
Expand Down
18 changes: 9 additions & 9 deletions spec/elixir-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -633,14 +633,14 @@ describe "Elixir grammar", ->
expect(tokens[2]).toEqual value: '\n"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']

{tokens} = grammar.tokenizeLine('@doc ~S"""\nTest\n"""')
expect(tokens[0]).toEqual value: '@doc ~S"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[1]).toEqual value: '\nTest', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[2]).toEqual value: '\n"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[0]).toEqual value: '@doc ~S"""', scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']
expect(tokens[1]).toEqual value: '\nTest', scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']
expect(tokens[2]).toEqual value: '\n"""', scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']

{tokens} = grammar.tokenizeLine("@doc ~S'''\nTest\n'''")
expect(tokens[0]).toEqual value: "@doc ~S'''", scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[1]).toEqual value: '\nTest', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[2]).toEqual value: "\n'''", scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[0]).toEqual value: "@doc ~S'''", scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']
expect(tokens[1]).toEqual value: '\nTest', scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']
expect(tokens[2]).toEqual value: "\n'''", scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']

it "does not highlight other sigil heredocs as comments", ->
{tokens} = grammar.tokenizeLine("@doc '''\nTest\n'''")
Expand All @@ -650,19 +650,19 @@ describe "Elixir grammar", ->
expect(tokens[0]).not.toEqual value: '@doc ~r"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']

{tokens} = grammar.tokenizeLine('@doc ~R"""\nTest\n"""')
expect(tokens[0]).not.toEqual value: '@doc ~R"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[0]).not.toEqual value: '@doc ~R"""', scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']

{tokens} = grammar.tokenizeLine('@doc ~c"""\nTest\n"""')
expect(tokens[0]).not.toEqual value: '@doc ~c"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']

{tokens} = grammar.tokenizeLine('@doc ~C"""\nTest\n"""')
expect(tokens[0]).not.toEqual value: '@doc ~C"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[0]).not.toEqual value: '@doc ~C"""', scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']

{tokens} = grammar.tokenizeLine('@doc ~w"""\nTest\n"""')
expect(tokens[0]).not.toEqual value: '@doc ~w"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']

{tokens} = grammar.tokenizeLine('@doc ~W"""\nTest\n"""')
expect(tokens[0]).not.toEqual value: '@doc ~W"""', scopes: ['source.elixir', 'comment.documentation.heredoc.elixir']
expect(tokens[0]).not.toEqual value: '@doc ~W"""', scopes: ['source.elixir', 'comment.documentation.heredoc.literal.elixir']

describe "functions", ->
it "tokenizes single line functions without parameters", ->
Expand Down