PowerShell / EditorSyntax

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

Inconsistency for coloring between splatting and functions #52

Closed DarkLite1 closed 6 years ago

DarkLite1 commented 7 years ago

A standard CmdLet like Select-Object is colored yellow, as this represents a function I assume this is normal. However, when using splatting, the properties are also indicated in yellow. This way it's hard to see the difference between a function and a splatting property.

Pictures say more... image

You can see that the word ErrorAction is yellow, the same as it is for a function. This seems to be incorrect. Also the coloring of the words -Property , ProcessName and @SelectParams isn't done. And the word $true is just a variable, which should have the same color as any other variable, like $SelectParams for example.

Test code for convenience:

$SelectParams = @{
    Property = 'ProcessName'
    Verbose  = $true
}

$SelectParams.ErrorAction = 'Stop'

Get-Process | Select-Object -Property ProcessName
Get-Process | Select-Object @SelectParams
omniomi commented 6 years ago

These issues are covered by the latest commit to master:

colours

Please note that specific colours depend on the theme chosen and some themes may colour items the same colour while others will separate them. The current definitions at least allow for them to be different.

A note on $true: The boolean variables (true/false) are considered constants not regular variables. Whether a theme chooses to colour them differently from regular variables is outside the control of the syntax definitions which need to be as accurate as possible. Here's an example of a theme that treats them the same:

theme-diff