PowerShell / EditorSyntax

PowerShell syntax highlighting for editors (VS Code, Atom, SublimeText, TextMate, etc.) and GitHub!
MIT License
133 stars 45 forks source link

Double-quoted strings treat @tokens as interpolations #149

Closed NReilingh closed 5 years ago

NReilingh commented 6 years ago

Environment

Issue Description

Double-quoted strings color @tokens the same as $tokens

Screenshots

image

Expected Behavior

Only $tokens or $(expressions) are string-interpolated in a double-quoted string. The @word is just going to be treated as part of the string.

Code Samples

This may be an appropriate spec test case:

    "This is a @double quoted string."
#   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.powershell
msftrncs commented 5 years ago

This has been mentioned in #137.

msftrncs commented 5 years ago

I was looking at the possible test case, but I don't think it is sufficient, but I may not entirely understand how the test works. In my mind, the entire string will scope as spec'd, regardless of whether the @double scopes as a splat or not.

msftrncs commented 5 years ago

Looks like this is needed?

# @splat references only work in argument mode, should not highlight in strings.
"This is a @double quoted string."
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ string.quoted.double.powershell
#           ^ not:variable.other.readwrite.powershell
TylerLeonhardt commented 5 years ago

That seems right, @msftrncs. I would recommend running the test before and after your change to see if it fixes the test.