PowerShell Syntax Highlighting

May 30th, 2017 by and tagged , , ,

With Windows 10 / Server 2016, PowerShell got command-line syntax highlighting. And what a difference that makes! With syntax highlighting, it’s easier to see a mistyped line of code as you make the mistake. Combined with intelligent tab-completion, my errors/command ratio is way, way down.

 

Many of the same advantages accrued to readers of this blog — by having syntax highlighting turned on, it was easier to follow the logic of the scripts and commands I posted here. Unfortunately, the tool we were using for that has ‘issues’, and hasn’t been actively developed or updated in several years. Reluctantly, the overall Site Admins for msmvps.com (who are GODDESSES and loved beyond belief!) have had to remove that plugin. It just had too many problems and with no active development, little chance they’d get fixed.  The result? All the code on this site is now plain text ugly. :(

 

ETA: Fixed. Mivhak to the rescue. It’s not perfect, but a huge improvement over nothing. And it looks like it’s easily customizable, so I might do some tweaking to improve contrast without going to a dark theme.

 

But wait! There’s hope! We think we’ve identified a solution that we can use, and that is still being actively maintained. It supports PowerShell, and it supports WordPress Multi-site. Both absolute requirements. The plug in is being actively tested while they continue the work of cleaning up the mess that the previous plugin created. Unfortunately, however, it will require me to go in and edit every single post that includes PowerShell code to enable the new plugin for that code. That process will take time. I’ll start with some of the most recent, and the most popular, and slowly work my way through them.

 

ETA: Whew! Mivhak is smart enough to recognize all my posts that had PRE tags and automatically syntax highlight them as PowerShell. That saves a BUNCH of work.

 

Until we have a confirmed solution, and I’ve had time to go in and edit each post, I’m afraid you’ll have to do it the hard way. Copy and paste the code into the syntax highlighting editor of your choice. And, speaking of which, have you tried Visual Studio Code? This is a slick, new, FREE, editor that supports easy customization, has full IntelliSense support(!!), and even has a plugin to enable Vi mode editing! How cool is that?! I’ve been playing around with it a lot lately, and I’m almost ready to switch from my beloved gVim.

Posted in Annoyances, PowerShell | Comments Off on PowerShell Syntax Highlighting



Comments are closed.