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

Adds support for handlebars {{!-- style comments #31

Merged
merged 1 commit into from Oct 20, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 15 additions & 2 deletions grammars/mustache.cson
Expand Up @@ -32,7 +32,10 @@
'mustache':
'patterns': [
{
'include': '#comment'
'include': '#block-comment'
}
{
'include': '#inline-comment'
}
{
'include': '#block-expression-start'
Expand All @@ -47,7 +50,17 @@
'include': '#template'
}
]
'comment':
'block-comment':
'begin': '{{!--'
'beginCaptures':
'0':
'name': 'punctuation.definition.comment.mustache'
'end': '--}}'
'endCaptures':
'0':
'name': 'punctuation.definition.comment.mustache'
'name': 'comment.block.mustache'
'inline-comment':
'begin': '{{!'
'beginCaptures':
'0':
Expand Down
7 changes: 7 additions & 0 deletions spec/mustache-spec.coffee
Expand Up @@ -36,6 +36,13 @@ describe 'Mustache grammar', ->
expect(tokens[8]).toEqual value: '}}', scopes: ['text.html.mustache', scopes..., 'string.quoted.single.html', 'meta.tag.template.mustache', 'entity.name.tag.mustache']
expect(tokens[9]).toEqual value: "'", scopes: ['text.html.mustache', scopes..., 'string.quoted.single.html', 'punctuation.definition.string.end.html']

it 'parses block comments', ->
{tokens} = grammar.tokenizeLine("{{!--{{comment}}--}}")

expect(tokens[0]).toEqual value: '{{!--', scopes: ['text.html.mustache', 'comment.block.mustache', 'punctuation.definition.comment.mustache']
expect(tokens[1]).toEqual value: '{{comment}}', scopes: ['text.html.mustache', 'comment.block.mustache']
expect(tokens[2]).toEqual value: '--}}', scopes: ['text.html.mustache', 'comment.block.mustache', 'punctuation.definition.comment.mustache']

it 'parses comments', ->
{tokens} = grammar.tokenizeLine("{{!comment}}")

Expand Down