Description
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#)
[AppDomain]::CurrentDomain.GetAssemblies() |
Foreach-Object { $_.GetTypes() } |
where fullname -match 'System.Management.Automation.Language.+Ast$' |
% name |
sort
Example Result
https://gist.github.com/JustinGrote/901d9db90b69bab8f104c851c80e8658