You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given Get-ChildItem -Path . -Recurse I cannot find a way to highlight "Path" and "Recurse". Currently I've only managed to highlight the -. The same goes for say "regex" in switch -Regex () {}.
It's gross but surly something like \\s\\-(?!(?i:[ic]?(?:eq|ne|gt|lt|ge|le|not|isnot|is|f|as|like|notmatch|match|notcontains|contains|in|and|or|xor|join|split|band|bor|bnot|bxor|replace))\\s)\\w+ would cover it? Provided it didn't step on constant.numeric and override negative integer highlighting.
Playing around on my own computer and adding this to powershell.tmLanguage.json:
On further experimentation the regex above does indeed catch negative integers. A quick n' dirty workaround is to include \\d+ in the negative lookahead as a purely numerical parameter name is unlikely although parameter names that include some numbers do exist such as -UseUTF16 on New-PSSessionOption making the \\w+ necessary.
I added this to my JSON file after all the other operators, seems to do the trick. I think the look ahead is redundant, but it was left over from the other operators. The scope was just what I experimented with.
I couldn't find anything definitive, can a parameter name begin with a digit? Or is that impossible since variable names cannot start with a digit? EDIT, forgot, in PowerShell, they can be entirely numeric! That raises the level of complexity.
Given
Get-ChildItem -Path . -Recurse
I cannot find a way to highlight "Path" and "Recurse". Currently I've only managed to highlight the-
. The same goes for say "regex" inswitch -Regex () {}
.It's gross but surly something like
\\s\\-(?!(?i:[ic]?(?:eq|ne|gt|lt|ge|le|not|isnot|is|f|as|like|notmatch|match|notcontains|contains|in|and|or|xor|join|split|band|bor|bnot|bxor|replace))\\s)\\w+
would cover it? Provided it didn't step onconstant.numeric
and override negative integer highlighting.Playing around on my own computer and adding this to powershell.tmLanguage.json:
I get the desired result although there may be edge cases I am not considering...
The text was updated successfully, but these errors were encountered: