Visual Studio Code - line break in SVG element declaration changes literal text foreground color

226 views Asked by At

3 SVG elements, two different quoted text colors

<path id="oneLine" d="M1,1 L2,2"/>
<path id="twoLines"
      d="M1,1 L2,2"/>
<path id="noTagClosure"

This issue is specific to inline SVG elements inside an HTML file. As of right now I am considering this an issue with the theme I am using. I am filing an issue on the github page for that theme here, though based on the current queue I'm not very hopeful for a response:
https://github.com/microsoft/vscode-themes/issues/42

I have however come upon a workaround that sets all this text to the same color in my HTML and SVG files. I added this bit to my settings.json, in the textMateRules section:

{
  "scope"   : ["string.quoted.double.html",
               "string.quoted.double.xml"],
  "settings": {"foreground": "#BC670F"}
},

The top line in the image is the correct color for quoted text in this context. I want to format with line breaks for readability, but the color change makes things less readable. I have reviewed the Inspect Editor Tokens and Scopes and the main difference between the first two paths is that "standard token type" is "String" for the first path and "Other" for the second path. The "textmate scopes" are different, but very similar, both starting with string.quoted.double.html.
The "foreground" for the first path is:
string { "foreground": "#BC670F", "background": "#FBE9AD1A", "fontStyle": "" }
For the second path it's:
meta.tag string.quoted { "foreground": "#6D98CF" }
The third path is included in the image to illustrate the possibility that VSCode thinks that the line break means that the SVG element is not properly terminated, even though it is.

So, my questions are:
a) How do I turn this off? Is there a way for me to set something so that breaking lines does not change the standard token type or any of the textmate settings?
b) If not, what textmate setting do I change to format these two situations the same way? I already have a settings.json that modifies the theme I am using, but I can't figure out what to set in this situation. Are there changes I can make to the source on github, here?

0

There are 0 answers