Skip to content

Commit

Permalink
Mark template expressions with meta.embedded.line tag
Browse files Browse the repository at this point in the history
**Problem**
VS Code themes currently hardcode a solution for reseting expression colorization inside of template string substitution expressions. This is not scalable since it js/ts specific

With microsoft/vscode#33120 I've proposed that VS Code themes reset styling inside of meta.embedded scopes to support this across multiple languages

**Fix**
Marks template substitution expressions with the additional `meta.embedded.line.ts` scope
  • Loading branch information
mjbvz committed Sep 6, 2017
1 parent c1e19d3 commit 1b4da07
Show file tree
Hide file tree
Showing 14 changed files with 83 additions and 78 deletions.
1 change: 1 addition & 0 deletions TypeScript.YAML-tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -1952,6 +1952,7 @@ repository:
'0': { name: punctuation.definition.template-expression.end.ts }
patterns:
- include: '#expression'
contentName: meta.embedded.line.ts

literal:
patterns:
Expand Down
2 changes: 2 additions & 0 deletions TypeScript.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -5378,6 +5378,8 @@
<string>#expression</string>
</dict>
</array>
<key>contentName</key>
<string>meta.embedded.line.ts</string>
</dict>
<key>literal</key>
<dict>
Expand Down
2 changes: 2 additions & 0 deletions TypeScriptReact.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -5324,6 +5324,8 @@
<string>#expression</string>
</dict>
</array>
<key>contentName</key>
<string>meta.embedded.line.tsx</string>
</dict>
<key>literal</key>
<dict>
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/Issue124.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^^^^^^^^^^^^^^^^
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts variable.other.constant.ts
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.constant.ts
^
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^^
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^^^^^^
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts variable.other.readwrite.ts
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^^^^^^^^^^^^^^^
Expand Down
12 changes: 6 additions & 6 deletions tests/baselines/Issue230.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,23 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts variable.other.object.ts
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.object.ts
^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.accessor.ts
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts punctuation.accessor.ts
^^^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts variable.other.property.ts
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.property.ts
^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts
^^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts variable.other.object.ts
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.object.ts
^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.accessor.ts
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts punctuation.accessor.ts
^^^^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts variable.other.property.ts
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.property.ts
^
source.ts meta.arrow.ts meta.block.ts meta.var.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^
Expand Down
20 changes: 10 additions & 10 deletions tests/baselines/Issue321.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -785,31 +785,31 @@ Grammar: TypeScript.tmLanguage
^^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts variable.other.readwrite.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts
^^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.begin.ts
^^^^^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts variable.other.readwrite.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts keyword.operator.arithmetic.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts keyword.operator.arithmetic.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts
^^^^^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts variable.other.readwrite.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts variable.other.readwrite.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts keyword.operator.arithmetic.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts keyword.operator.arithmetic.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts constant.numeric.decimal.ts
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts meta.embedded.line.ts constant.numeric.decimal.ts
^
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.block.ts meta.block.ts meta.arrow.ts meta.block.ts meta.block.ts meta.block.ts new.expr.ts string.template.ts meta.template.expression.ts punctuation.definition.template-expression.end.ts
^
Expand Down
Loading

0 comments on commit 1b4da07

Please sign in to comment.