diff --git a/JavaScriptNext.YAML-tmLanguage b/JavaScriptNext.YAML-tmLanguage index 52fda17..e5b9fe7 100644 --- a/JavaScriptNext.YAML-tmLanguage +++ b/JavaScriptNext.YAML-tmLanguage @@ -32,6 +32,7 @@ repository: - include: '#literal-regexp' # before operators to avoid ambiguities - include: '#literal-number' + - include: '#literal-tagged-html' - include: '#literal-template-string' - include: '#literal-string' - include: '#literal-language-constant' @@ -985,6 +986,19 @@ repository: patterns: - include: '#expression' + literal-tagged-html: + patterns: + - contentName: text.html.basic.embedded.js + begin: '(html)(`)' + beginCaptures: + '1': {name: meta.function-call.tagged-template.js} + '2': {name: punctuation.definition.string.template.begin.js} + end: '`' + endCaptures: + '0': {name: punctuation.definition.string.template.end.js} + patterns: + - include: 'text.html.basic' + literal-regexp: patterns: # ignore ++, -- since they're uncommon, distinguishing them is not possible in sublime text, see: diff --git a/JavaScriptNext.tmLanguage b/JavaScriptNext.tmLanguage index f7cb135..d51affc 100644 --- a/JavaScriptNext.tmLanguage +++ b/JavaScriptNext.tmLanguage @@ -228,6 +228,10 @@ include #literal-number + + include + #literal-tagged-html + include #literal-template-string @@ -2244,79 +2248,6 @@ - literal-template-string - - patterns - - - begin - ([a-zA-Z$_][\w$_]*)?(`) - beginCaptures - - 1 - - name - entity.template-string.tag.name.js - - 2 - - name - punctuation.definition.template-string.begin.js - - - end - ` - endCaptures - - 0 - - name - punctuation.definition.template-string.end.js - - - name - string.template-string.js - patterns - - - include - #string-content - - - begin - \${ - beginCaptures - - 0 - - name - punctuation.template-string.element.begin.js - - - end - } - endCaptures - - 0 - - name - punctuation.template-string.element.end.js - - - name - entity.template-string.element.js - patterns - - - include - #expression - - - - - - - literal-regexp patterns @@ -2523,6 +2454,121 @@ + literal-tagged-html + + patterns + + + begin + (html)(`) + beginCaptures + + 1 + + name + meta.function-call.tagged-template.js + + 2 + + name + punctuation.definition.string.template.begin.js + + + contentName + text.html.basic.embedded.js + end + ` + endCaptures + + 0 + + name + punctuation.definition.string.template.end.js + + + patterns + + + include + text.html.basic + + + + + + literal-template-string + + patterns + + + begin + ([a-zA-Z$_][\w$_]*)?(`) + beginCaptures + + 1 + + name + entity.template-string.tag.name.js + + 2 + + name + punctuation.definition.template-string.begin.js + + + end + ` + endCaptures + + 0 + + name + punctuation.definition.template-string.end.js + + + name + string.template-string.js + patterns + + + include + #string-content + + + begin + \${ + beginCaptures + + 0 + + name + punctuation.template-string.element.begin.js + + + end + } + endCaptures + + 0 + + name + punctuation.template-string.element.end.js + + + name + entity.template-string.element.js + patterns + + + include + #expression + + + + + + + literal-variable patterns