-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable 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. 😄 Themes don't expect to have to handle that many different ideas. One option is to add a higher precedence more specific scope, but I am finding some issue with that, in that Atom doesn't support that yet, that I have heard. I need to prove to Atom that TextMate supports it, but I have some ideas for workarounds involving more complicated rules. |
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)
The text was updated successfully, but these errors were encountered: