vscode-powershell
vscode-powershell copied to clipboard
When using F8 colors are not preserved in the console
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all issues to ensure it has not already been reported.
- [X] I have read the troubleshooting guide.
- [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
Summary
When you use F8 over highlighted code it's pasted without any colors. If you copy/paste (or type) the colors are there.
PowerShell Version
Name Value
---- -----
PSVersion 5.1.22000.282
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22000.282
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Visual Studio Code Version
1.64.2
f80445acd5a3dadef24aa209168452a3d97cc326
x64
Extension Version
[email protected]
[email protected]
[email protected]
[email protected]
Steps to Reproduce
Use F8 to "run code" and notice no colors in the console.
Visuals
No response
Logs
No response
@andschwa I think this is because the F8 takes a different code path, can we still run it through psreadline somehow for the output?
@andschwa I think this is because the F8 takes a different code path, can we still run it through psreadline somehow for the output?
Yeah we just write it to host, sort of pretending that it's REPL input. I always wanted to go back and write a syntax highlighted input writer, or add an API to PSRL that we could use to get it's formatted output.
One of those would be the solution. Preferably the latter so we'd be in sync with any changes PSRL makes.
@JustinGrote This doesn't affect just the preview does it? I'm pretty sure that code is unchanged between the two (we're literally just getting plaintext in an LSP message).
Yep! Been like that since PSRL integration was added (well before that too since we didn't have syntax highlighting at all before then).
Actually there are some regressions in the preview version.
In both versions Write-Warning 'color works'
F8 or not result in yellow warning.
In preview Write-Warning 'color?'
or NotExistingCommand
F8 or not will be colorless, in stable both are red.
@ili101 We actually just fixed the Write-Warning
colors, but haven't done a release since merging the fix. I'll ping this issue when we get that out (hopefully this week).
I see the errors are red now on v2022.3.0 👍, I didn't notice other color regressions in preview (maybe you spot something I missed). So probably only @PrzemyslawKlys original problem remains (sorry for hijacking your issue 😁)
Issue still present with v2022.6.3