code -v
1.16.1
27492b6bf3acb0775d82d2f87b25a93490673c6d
$pseditor.EditorServicesVersion
Major Minor Build Revision
1 4 1 0
code --list-extensions --show-versions
eamodio.[email protected]
filipw.[email protected]
formulahendry.[email protected]
groksrc.[email protected]
jcanero.[email protected]
johnpapa.[email protected]
justusadam.[email protected]
ms-mssql.[email protected]
ms-vscode.[email protected]
ms-vscode.[email protected]
ms-vscode.[email protected]
ms-vscode.[email protected]
ms-vsts.[email protected]
msazurermtools.[email protected]
PeterJausovec.[email protected]
rebornix.[email protected]
usqlextpublisher.[email protected]
Vans.[email protected]
VisualStudioOnlineApplicationInsights.[email protected]
vsciot-vscode.[email protected]
wayou.[email protected]
$PSVersionTable
Name Value
---- -----
PSVersion 5.1.15063.608
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.15063.608
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```
Where-Object is miscoloured. The verb 'where' is coloured, but the noun 'object' is not.
Follow the instructions in the README
about capturing and sending logs.

This is most likely an issue with the https://github.com/powershell/editorsyntax project.
It looks like this regex is hitting before the Where-Object regex:
<key>controlWords</key>
<dict>
<key>match</key>
<string>(\b(?<!-|\$)(?i:begin|process|exit|break|return|catch|finally|for|continue|foreach|throw|from|trap|try|do|if|until|in|using|else|elseif|while|end|where)\b(?!-|\.))</string>
<key>name</key>
<string>keyword.control.powershell</string>
</dict>
where is NOT a language keyword according to these docs. So perhaps it should be removed from the above. Although you'd think that Foreach-Object would have the same issue.
This bugs me to. This is what I have for my PowerShellSyntax.tmLanguage installed within my vscode (1.16.1) on OSX.
PS /Applications/Visual Studio Code.app/Contents> gci -Recurse -Filter Power*.tm*
Directory: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/powershell/syntaxes
Mode LastWriteTime Length Name
---- ------------- ------ ----
------ 9/19/17 9:05 PM 32062 PowershellSyntax.tmLanguage
File itself appears to be very different from https://github.com/PowerShell/EditorSyntax/blob/master/PowerShellSyntax.tmLanguage
foreach has an exclusion with object. where should get the same treatment or outright removed as @rkeithhill recommended.
<dict>
<key>match</key>
<string>(?<!\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|using|var|where|while)|%|\?)(?!\w)</string>
<key>name</key>
<string>keyword.control.powershell</string>
</dict>
Adding the following (in patterns section) with the exclusion above for where corrects the issue in my case.
<dict>
<key>comment</key>
<string>Builtin cmdlets with reserved verbs</string>
<key>match</key>
<string>(?<!\w)(?i:where-object)(?!\w)</string>
<key>name</key>
<string>support.function.powershell</string>
</dict>
Even stranger on vscode (1.16.1) for Windows.
<string>(?<!\w)((?i:begin|break|catch|continue|data|define|do|dynamicparam|else|elseif|end|exit|finally|for|foreach(?!-object)|from|if|in|inlinescript|parallel|param|process|return|switch|throw|trap|try|until|using|var|where(?!=-object)|while)|%|\?)(?!\w)</string>
I don't believe where(?!=-object) is correct. The = shouldn't be there.
@rkeithhill any idea what repo we should escalate this to?
Yes, we should move this whole issue over to https://github.com/powershell/editorsyntax
I believe @daviwil has a tool and the privs to move issues.
I don't think the whole where(?!=-object) should be there. AFAICT where is not a keyword. It doesn't show up in about_Languages_keywords.
@rkeithhill but where is an alias just like foreach.
Sort and Select are aliases as well but they show up in a different color - white.
Per @daviwil comments https://github.com/Microsoft/vscode/pull/34701 there is a larger update to cover mutiple issues including this one. I think we can close this issue out here.
Yep, we've overhauling the syntax definition, hoping to have that ready soon. Thanks for your PR! I'll close this issue now.
Most helpful comment
This bugs me to. This is what I have for my
PowerShellSyntax.tmLanguageinstalled within my vscode (1.16.1) on OSX.File itself appears to be very different from https://github.com/PowerShell/EditorSyntax/blob/master/PowerShellSyntax.tmLanguage
foreachhas an exclusion withobject.whereshould get the same treatment or outright removed as @rkeithhill recommended.Adding the following (in patterns section) with the exclusion above for
wherecorrects the issue in my case.