PowerShell / EditorSyntax

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

Class keyword is incorrectly colored when used as a parameter #43

Closed pcgeek86 closed 6 years ago

pcgeek86 commented 7 years ago

Here is a specific, reproducible example where the class keyword is improperly colored in Visual Studio Code.

Example Code

function Test-Function {
  [CmdletBinding()]
  param (
    [string] $Class
  )
}

### Notice the blue color of "Class", indicating that it is a reserved language keyword.
Test-Function -Class asdf

### Notice how the "-Name" parameter is colored differently than "-Class" above
Get-Process -Name asdf

Screenshot of Result

screen shot 2017-03-23 at 7 17 49 am

Diagnostic Details

➜  ~ code --list-extensions --show-versions
Alexander.theme-sublime-oceanicnext@0.0.3
Nuuf.theme-hackershaze@1.3.1
PeterJausovec.vscode-docker@0.0.13
abusaidm.html-snippets@0.1.0
akamud.vscode-theme-onedark@1.3.1
aws-scripting-guy.cform@0.0.9
azemoh.one-monokai@0.2.4
christian-kohler.npm-intellisense@1.3.0
donjayamanne.python@0.6.0
ecmel.vscode-html-css@0.0.33
eg2.vscode-npm-script@0.1.8
fknop.vscode-npm@3.3.0
jakeboone02.mediawiki@2.1.0
jprestidge.theme-material-theme@1.0.1
ms-vscode.PowerShell@0.10.1
ms-vscode.csharp@1.8.0
searKing.preview-vscode@1.1.4
➜  ~ code -v
1.10.2
8076a19fdcab7e1fc1707952d652f0bb6c6db331
➜  ~ powershell -Command '$PSversionTable'

Name                           Value
----                           -----
PSVersion                      6.0.0-alpha
PSEdition                      Core
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   3.0.0.0
GitCommitId                    v6.0.0-alpha.17
CLRVersion
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Cheers, Trevor Sullivan

omniomi commented 6 years ago

Need to add a negative lookbehind for - on the class match.

kborowinski commented 6 years ago

@omniomi I guess we can close that one Nick.

omniomi commented 6 years ago

Resolved by @kborowinski in #99