atom / language-css

CSS package for Atom

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSS syntax highlighting doesn't handle strings with line continuations correctly

aeschli opened this issue · comments

From @kellyjp on September 9, 2017 13:23

  • VSCode Version: Code 1.16.0 (787b31c0474e6165390b5a5989c9619e3e16f953, 2017-09-06T16:12:42.401Z)
  • OS Version: Darwin x64 16.7.0
  • Extensions: Extensions are disabled

Steps to Reproduce:

  1. Create a CSS file containing a string that has a line continuation (backslash newline).

Expected Output:

The syntax highlighting shows the continued line as being a continuation of the string.

Actual Output:

The syntax highlighting treats the string as having ended at the line continuation and formats the continued line as if it was not part of the string. This can be verified using the Developer: Inspect TM Scopes command.

Reproduces without extensions: Yes

Here is a simple test case:

#testcase::before {
    content: 'long string\
    using line continuation';
}

Here is how Visual Studio Code syntax highlighting shows the test case:
vscode

For comparison here is how Atom (1.19.5) syntax highlighting correctly shows the test case:
atom

Copied from original issue: microsoft/vscode#34076

Well, now... that's interesting. Would certainly say it's a bug in VSCode's implementation of TextMate grammars, except the same thing is happening on GitHub too:

#testcase::before {
	content: 'long string\
	using line continuation';
}

I'd better look into this and see what's goin' on...

EDIT: Okay, there's no logical reason it should be doing this, so I think it really does have something to do with implementation. Since this affects GitHub as well, I'll look at fixing this up with a PR later... 😞