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
There are several language elements in Powershell that aren't covered by the current syntax highlighter. Since PSReadline uses AST, the list of possible elements could be dynamically queried from AST and added as color options to the color settings hashtable. This would require a little reworking of the current settings method since the options are hard-coded today.
This would enable accurate representation and reproduction to match some editor theme styles. For instance, in the PSES TM syntax, the function keyword can be highlighted differently (and is by default in VSCode Dark+ Theme) than other keywords, but not so in PSReadline.
For example, the function keyword can be highlighted as a separate element using the PSES Textmate grammar, however PSReadline sees it just as an operator.
VSCode Editor
PSReadline
Example of querying possible AST types (I'm sure there's a way better method to call somewhere in C#)
Couldn't you simply opt to internally cast all the keys to tokenkind to see which they'd be applicable to? Would bypass the need for the awkward syntax.
Maybe just support a string syntax as well to cut down on the awkward symbology, like a key named 'Token:Command' is considered to be [TokenKind]::Command
@vexx32's option makes sense to me to preserve backward compatibility while allowing for flexible direct casting to the TokenKind enum and keeping the syntax simple, however I don't have a problem either way if you want to preserve strict typing there.
This is a continuation of #981
There are several language elements in Powershell that aren't covered by the current syntax highlighter. Since PSReadline uses AST, the list of possible elements could be dynamically queried from AST and added as color options to the color settings hashtable. This would require a little reworking of the current settings method since the options are hard-coded today.
This would enable accurate representation and reproduction to match some editor theme styles. For instance, in the PSES TM syntax, the function keyword can be highlighted differently (and is by default in VSCode Dark+ Theme) than other keywords, but not so in PSReadline.
For example, the function keyword can be highlighted as a separate element using the PSES Textmate grammar, however PSReadline sees it just as an operator.
VSCode Editor
PSReadline
Example of querying possible AST types (I'm sure there's a way better method to call somewhere in C#)
Example Result
https://gist.github.com/JustinGrote/901d9db90b69bab8f104c851c80e8658
The text was updated successfully, but these errors were encountered: