I’ve recently started experimenting with PowerTab version 0.98 on one of my systems where I use PowerShell. I hadn’t done this before for quite a few reasons:
- I wanted to work with PowerShell 1.0 without modifications for at least the first little while to see how well it works by itself (suffice it to say that this is the best 1.0 release of a product I have used in a long time).
- Beyond the initial experience with PowerShell 1.0, the built-in tab expansion was meeting my immediate needs when writing one-liners.
- Whenever I would write anything more complex that a one-liner I would do so in an editor that had built-in syntax highlighting and/or intellisense (I say and/or because I’ve been trying out quite a few different script editors), and PowerTab wasn’t available within those editors.
But after listening to Scott Hanselman talk about PowerShell (and PowerTab) on a recent episode of .NET Rocks TV, I figured it was time I install this component that I’ve had sitting in my downloads folder since version 0.91 or so and kick the tires a bit.
While I haven’t used PowerTab for very long yet, so far I can say that PowerTab provides some really nice enhancements over the built-in tab expansion functionality, and if you’re working within the console that ships with PowerShell 1.0 it definitely helps, especially when working with WMI objects and .NET objects directly. The visual browsing functionality it provides will be of greatest benefit to newcomers who don’t know their way around PowerShell, WMI and .NET yet.
That said, there are a few issues I have encountered in the current release, as well as some opportunities for enhancement requests that are worth mentioning. First, the issues:
- If you are viewing the tab expansion window for the current word and you press backspace or Esc, you can’t use tab expansion for that word from that point on. For example, if you type in get-c, press tab, and then once you see your options you press backspace or Esc, tab completion will no longer work for get-c until you use tab expansion for something else.
- If you are viewing the tab expansion window for the current word and you press backspace or Esc, you should be returned to the exact command you started with because you are cancelling out of the option to use tab expansion on that word. This does not work properly for files or directories. When you press backspace or Esc the word has changed. For example, if I am in a folder with nothing but tab.txt and tabexpansion.txt, and I type in “t” and then press the Tab key, I see the two files. If I then press backspace or Esc, the word I entered changes from “t” to the current working directory path with “\t” appended to it (prepended by “& ‘” and appended by “‘” if there is a space in the current working directory).
Now on to the enhancement requests:
- If you are viewing tab expansion options for a file or folder and you press backslash or space, that option should be selected and you should see your backslash or space in the command line. This is necessary to prevent from additional keystrokes being required in the implementation of tab expansion (i.e. this is how it works in DOS and in PowerShell 1.0 when using the tab expansion routine that comes with PowerShell). When you get to know what the minimum path is that you have to type, this can speed things up for you. Having to press enter and then type the backslash is disruptive to how things worked before. For example, using the tab expansion that comes with PowerShell, if I have two folders called “Tab” and “TabExpansion” and I know I want to navigate to the first folder I can type set-location C:\T, press the Tab key, and then press space or backslash depending on what I am doing and it will just continue. If I do the same when using PowerTab it will beep at me when I press space, or it will do nothing when I press backslash. I’d love to see this changed so that space and backslash will properly allow me to continue typing. The same goes for files (although for files backslash doesn’t make sense, but space does).
- Similar to the last one, if you are viewing tab expansion options for a .NET class and you press the right square bracket “]”, the current option should be selected and you should see your .NET class with the “]” character at the end in the command line. Basically I think that if you press any character that is a valid terminator for the item that is showing in the tab expansion option list that the item should be terminated and you should see it with your terminator in the current line of script you are writing.
- When you have a line of script on the screen and you activate tab expansion in the middle of that script, the remainder of that line of script is deleted. This is an issue with tab expansion in the standard command prompt and the tab expansion that comes with PowerShell 1.0. The impact of this issue is much more apparent in PowerShell when working with long one-liners (although you have command history so you can usually go back unless you just typed in a long one-liner from scratch). I’d love to see this fixed with PowerTab, but I think this is beyond the control of what can be done in the TabExpansion function.
That’s about it for now. I’ll continue experimenting with PowerTab and see what else I come across. Kudos to Marc van Orsouw (MOW) for all of his hard work on PowerTab! I look forward to seeing this functionality in PowerShell Plus!