-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Quoting in subexpressions in string literals is quite confused #17887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Write-Output '$( Write-Output "hello)" hello) ''hello)'' )'
Write-Output $( Write-Output '"hello)" hello) ''hello)''' ) |
Also is related to: #4543 |
Yes, I am using the powershell extension for VSCode. VSCode 1.69.1
https://github.com/PowerShell/vscode-powershell
The inconsistent coloring happens in the text editor window, but seems to
match powershell in the console tool window.
|
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
1 similar comment
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you. |
This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes. |
Yea this is definitely a bug.
The escapes are being parsed before the sub expression. A sub expression should be completely independent of the string it's contained in. |
Uh oh!
There was an error while loading. Please reload this page.
Prerequisites
Steps to reproduce
I was attempting to write a function to escape a string to correctly print a string for generated powershell code.
The rules for escaping double-quotes inside a double-quoted string are obscure at best, and quite broken depending on your point of view.
The coloring in the powershell console appears to mostly match the code behavior, but tools like VSCode do not match powershell behavior.
Here is a block of code demonstrating a number of issues
#1: Escaping isn't required, but sometimes it is allowed
#2: To have double-quotes inside an embedded string requires double backticks, yet only a single backtick is necessary for things like newline.
#3: Parans inside a nested string confuse powershell
#3: Doubling nested double-quotes seems to escape them, but there is a lot of wiggle room for how many double quotes is needed.
Expected behavior
Actual behavior
Error details
Environment data
Visuals
VSCode

The text was updated successfully, but these errors were encountered: