Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upVariable colors are prioritized over hashtable colors for keys in hashtables #182
Comments
|
A better scope for bareword key names is These are from my PR #156 and my custom theme in VS Code: There are further things wrong with the hashtable portion of the grammar. A key of a hashtable is actually a non-expandable argument (err operand or identifier actually), which can include unary expressions, and these are not currently correctly handled, as they lose the PowerShell ISE/PowerShell AST/Tokenizer treats the bareword key name as 'MemberName', which is the equivalent of |
|
Isn't this line the regex used for meta.hashtable.assignment? EditorSyntax/PowerShellSyntax.tmLanguage Line 1502 in d10ae29 As far as I can tell that only captures up to the "=" part and when I use the inspect TM scopes feature to check out the value part of the statement it seems to confirm this. It's good that your PR fixes the hashtable keys, but I'm not a fan of making class methods like: |
|
That's the line, but it also only works for bareword/indentifier situations, because the regex is syntactically incorrect to capture the quotes, and incorrectly allows identifiers starting with numeric digits. The The intention of meta scopes was to aid tools, such as for region selection, or, for instance, The complexities with the methods and functions/cmdlets sharing the same scope comes from the fact that PowerShell does too many things. |
|
In PR #156 I did use slightly different scopes between methods and functions, This way a normal theme will catch them both with |



Keys inside hashtables use the "variable.*" scope over the more specific "meta.hashtable.assignment" scope, this means you can't give keys inside hashtables a custom color that is different from variables.
(Screenshot is from VS code using the "Inspect TM scopes" feature)