sgwozdz / jenkinsfile-support

Visual Studio Code extension
MIT License
33 stars 7 forks source link

String interpolations don't highlight #57

Open lilyball opened 4 years ago

lilyball commented 4 years ago

Describe the bug This syntax does not highlight Groovy string interpolations.

For example, given the following code:

def foo = "bar ${flag ? "baz" : "wat"} qux"

Expected behaviour The string interpolation should be highlighted separately. Ideally the ${} delimiters should get special highlighting, and then the contents should be highlighted as groovy code.

Actual behaviour A string interpolation is highlighted exactly the same as the string itself, down to the editor scopes. A string nested inside the interpolation actually ends the outer string.

When I inspect editor tokens and scopes, the interpolation has the scope source.jenkins > string.quoted.double.jenkins (which is identical to the string outside of the interpolation), and is colored according to string. When I enter a nested string in the interpolation, it reverts to just source.jenkins, indicating that the outer string simply ended there.

Screenshots

image

Additional context

I saw #37 (Nested string interpolation not highlighted correctly) and @sgwozdz posted a screenshot indicating that interpolation contents were indeed being highlighted separately (though the interpolation did not highlight groovy tokens within it, the whole thing was one solid color, which seems wrong. I don't know why the behavior differs there.

I have version 1.1.0 installed.

lodi-g commented 3 years ago

I'm having the same problem, but for any strings. Not sure what's wrong in my Jenkinsfile :/

image