What makes a good PowerShell editor?

Windows PowerShell v2 ships with an "Integrated Scripting Environment," or ISE. It's actually intended to be a "graphical shell" (and was originally called that), and one of its driving features is support for double-byte character sets. That's right, the original text-based console can't handle double-byte character sets, which means a lot of people couldn't use the shell because it couldn't display their language.

Don Jones

May 3, 2010

4 Min Read
ITPro Today logo in a gray background | ITPro Today

Windows PowerShell v2 ships with an "Integrated Scripting Environment," or ISE. It's actually intended to be a "graphical shell" (and was originally called that), and one of its driving features is support for double-byte character sets. That's right, the original text-based console can't handle double-byte character sets, which means a lot of people couldn't use the shell because it couldn't display their language.


Anyway, in addition to that better character support, the ISE also adds a few Visual Studio-esque features designed to make PowerShell a bit easier to work with. So let's consider some of the major features that go into a better editing experience. 


First, we have to draw a distinction between an interactive shell and a script editor. A shell is designed to let you type a command, hit enter, and see the results; an editor is designed to let you type a bunch of commands and then run them all as a batch. Some editors blur the line: The ISE, for example, includes an interactive pane as well as a script pane, and you can hide the script pane if you just want to use the interactive mode. Ideally, most of the features I'll be describing should work in both interactive and scripting mode - but that isn't always the case in the ISE, and it also isn't the case with other editors you might find.


One of the core features any good editor should include is support for better formatting. I like to see color-coding of commands and parameters, automatic indenting for scripting constructs, and at least basic undo/redo support. Ideally, I like editors that persist undo information someplace (often in an alternate stream of the file) so that I can access undo steps even after closing the file and reopening it months later.


Another core feature is code hinting and completion, what Microsoft calls "IntelliSense." This usually manifests in two ways: Little pop-up menus that appear when you start typing a command, and help you complete the command more quickly, and little tool tips that remind you of command syntax. Ideally, command completion will also work for things like parameters, WMI classes (although that's technically complicated to implement), and other things. The idea is to help you type quicker and more accurately, and reduce the need to turn to the help files.


Snippets of some kind are another good feature to have: Once you've mastered a complicated command or a hunk of script, snippets offer a way to save that and re-use it easily in the future. Think of them as a kind of permanent clipboard; I like snippet features that are keyboard-accessible, perhaps using a command completion-like pop-up menu.


Access to debugging features is also key. I want to be able to click somewhere to set breakpoints, and when a script is in "break" mode I want to hover over variables and, ideally, object properties to see what values are contained within them. PowerShell supports a variety of breakpoints, and an editor should provide support for all of them (even if it does so by using its own debugging mechanism rather than the shell's). 


Quick access to help is a must-have. I don't want to view the help inline; I want it in a different pane, so I can float it to the side and access it while I'm typing a command. It should be context-sensitive, so that I can move my cursor over a command, hit a function key, and have the help for that command pop right up. An especially smart help window would realize when I'm over a WMI class and perhaps pull up online documentation for that class. 


Finally, I want an editor to make it easy to utilize PowerShell extensions - snap-ins and modules. An editor should be willing to run my profile script, so that whatever custom stuff I have in there also takes place in the editor. 

Many commercial editors pack in these features and many more; the PowerShell ISE included with PowerShell v2 doesn't provide all of them (and I don't think it should - Microsoft shouldn't be trying to replicate Visual Studio for PowerShell, and they shouldn't be giving the competitive PowerShell editor market a reason to stop selling their products). 


Why am I so concerned about what makes for a good editor? Beginning in June 2010, I'm going to start reviewing some of the major editors that are on the market, and what's in this article will form my evaluation criteria. I'll explore a new editor product every other week or so, and conclude with a roundup. This is a good time for you to share your must-have features, as well - leave a comment and let me know what you care about in a PowerShell editor.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like