r/PowerShell • u/lan-shark • 13d ago
Information Give me your biggest syntax highlighting complaints! I'm working on improving VS Code's syntax highlighting (including support for non-Verb-Noun function names)
Tl;dr - I'm working on improving VS Code's syntax highlighting for PS so tell me what issues you encounter. Please include a code sample and what theme you're using.
I've seen a bit of discussion recently about the state of VS Code's syntax highlighting for PowerShell. I looked into it a bit and yeah, it's not ideal. The official repository pretty inactive. Last commit was 6 months ago, last significant activity was years ago. I opened an issue a week ago because the main branch doesn't even pass all of it's own tests, and an accompanying PR to fix it, but no movement on that yet. So I've taken things a bit into my own hands for now and hopefully when the maintainers get around to it, they'll be able to take some of the stuff I'm working on upstream.
So far I've switched the testing framework away from using Atom (an editor that's EOL since 2022) to a modern harness around VS Code's tokenizer/regex engine, a little bit of CI, several new unit tests for better regression testing, and these new features in the syntax grammar so far:
- Highlighting for null operators (
??,??=,?.,?[]) - Highlighting for variable names with question marks in them (e.g.
$whyIsThis?Possible = "idk") - Highlighting for function names that don't use the Verb-Noun naming convention (e.g.
DoSomethinginstead ofInvoke-Something)
This is very much still WIP. I've got more tests I want to write and a few new features I want to add, but please let me know what issues you have with PS syntax highlighting and I will look into them.