EditorSyntax icon indicating copy to clipboard operation
EditorSyntax copied to clipboard

Possible updates for the new ternary operator added in PowerShell language

Open daxian-dbw opened this issue 5 years ago • 7 comments

The ternary operator will soon be added to the PowerShell language, which may cause syntax colorization issue. Open this issue to track the possible changes needed in this repo.

daxian-dbw avatar Aug 19 '19 21:08 daxian-dbw

Still problem with the ? ternary operator

image

Fix coming soon?

Satak avatar Nov 23 '20 12:11 Satak

Do you have the ternary operator on the same line as the expression?

$true ? "f" : "s" 

Vs

$true
? "f" : "s"

It has to be on the same line.

TylerLeonhardt avatar Nov 23 '20 16:11 TylerLeonhardt

it's like this $true ? "f" : "s"

Satak avatar Nov 23 '20 17:11 Satak

image

Satak avatar Nov 23 '20 17:11 Satak

@Satak What version of PowerShell are you using?

daxian-dbw avatar Nov 23 '20 17:11 daxian-dbw

@Satak What version of PowerShell are you using?

Sorry my bad. I just realized that the default PS is set to 5.1 at VS Code. I have installed 7.1 to my machine and after switching Powershell to 7.1 it works. Is there a place to set the default PS to 7.1 in VS Code?

Satak avatar Nov 23 '20 17:11 Satak

Do you see the version number at the bottom right when you have a PowerShell file open? image

If you click on that, you can set which version you want to use. That will set the default.

TylerLeonhardt avatar Nov 24 '20 03:11 TylerLeonhardt