Skip to content

Commit af5a8a1

Browse files
Renames Quasi literal to Template literal
- Renamed literal-quasi definition to literal-string-template - Renamed all occurences of quasi in scopes to template - Added test cases scope name changes: entity.template.tag.name.js -> entity.name.function.template.tag.js // tags are functions, update the scope to reflect // that allows for function name highlighting punctuation.template.element.begin.js -> punctuation.template.expression.begin.js // Changed to 'expression' since that's what they are entity.template.element.js -> template.expression.embedded.js // the whole area is an embedded expression, but I'm // not quite sure on the whole name of the scope here punctuation.template.element.end.js -> punctuation.template.expression.end.js // Changed to 'expression' since that's what they are
1 parent 984339f commit af5a8a1

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

JavaScript/JavaScript.sublime-syntax

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ contexts:
7474
- include: literal-prototype
7575
- include: literal-regexp
7676
- include: literal-number
77-
- include: literal-quasi
77+
- include: literal-string-template
7878
- include: literal-string
7979
- include: literal-language-constant
8080
- include: literal-language-variable
@@ -778,26 +778,26 @@ contexts:
778778
scope: punctuation.terminator.statement.js
779779
- match: ","
780780
scope: meta.delimiter.comma.js
781-
literal-quasi:
781+
literal-string-template:
782782
- match: '([a-zA-Z$_][\w$_]*)?(`)'
783783
captures:
784-
1: entity.quasi.tag.name.js
785-
2: punctuation.definition.quasi.begin.js
784+
1: entity.name.function.template.tag.js
785+
2: punctuation.definition.template.begin.js
786786
push:
787-
- meta_scope: string.quasi.js
787+
- meta_scope: string.template.js
788788
- match: "`"
789789
captures:
790-
0: punctuation.definition.quasi.end.js
790+
0: punctuation.definition.template.end.js
791791
pop: true
792792
- include: string-content
793793
- match: '\${'
794794
captures:
795-
0: punctuation.quasi.element.begin.js
795+
0: punctuation.template.expression.begin.js
796796
push:
797-
- meta_scope: entity.quasi.element.js
797+
- meta_scope: template.expression.embedded.js
798798
- match: "}"
799799
captures:
800-
0: punctuation.quasi.element.end.js
800+
0: punctuation.template.expression.end.js
801801
pop: true
802802
- include: expression
803803
literal-regexp:

JavaScript/syntax_test_js.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ var str2 = 0;
3333
// ^ variable.other.readwrite
3434
// ^ keyword.operator.assignment
3535

36+
tag`Hello ${ a + b } world\nanother ${expression}.`;
37+
// <- entity.name.function.template.tag.js
38+
// ^ punctuation.definition.template.begin.js
39+
// ^ string.template.js
40+
// ^ punctuation.template.expression.begin.js
41+
// ^ variable.other.readwrite.js
42+
// ^ keyword.operator.arithmetic.js
43+
// ^ template.expression.embedded.js
44+
// ^ punctuation.template.expression.end.js
45+
// ^ constant.character.escape.js
46+
// ^ punctuation.definition.template.end.js
47+
3648
var obj = {
3749
key: bar,
3850
// <- meta.object-literal.key

0 commit comments

Comments
 (0)