SAPIEN PowerShell Studio 2014–Navigation

Continuing my series on SAPIEN PowerShell Studio (website), the next feature I want to focus on is Navigation, both of your files and inside the code.

From a file perspective, PowerShell Studio allows you to organize into projects. Right now I am working on two modules plus one set of scripts which accomplish a common task. Each module I have organized into a project. Here is the project window for one of the modules I’m developing:

image

This allows me to quickly navigate between the various files I have in the project. I can easily open and close these files as I work on them without having to go through the laborious “File, Open…” mechanism in the PowerShell ISE. My other project is the collection of files which consume these modules. Each file performs a specific task, but ultimately get us to a completed solution. Using the Project feature in PowerShell Studio allows me to organize these into one solution, quickly jumping back and forth between them.

Even better, I can have these three items open in separate PowerShell Studio windows at the same time. Note that I did need to go into the Options window, and check on “Allow multiple instances” option.

image

This is a far, far easier way to work than inside the PowerShell IDE included with the native Microsoft PowerShell installation. Speaking of easy, let’s look at code navigation.

One of the first features is the functions window. This simply lists all the functions in the currently open code editor window. Simply double click on one to jump to that function.

image

This is awesome in an large script with many functions.

Next is the ability to easily expand / contract code.

image

You can quickly expand and collapse sections of code to make scrolling through it easier, allowing you to look at only the sections you need to see. I have one script of nearly 1,500 lines, and have placed regions throughout. This feature allows me to focus only on the code I want, and neatly hide what I am not currently working on.

The next thing I’d like to show is the split code window. This allows me to take a single code window, and look at two different parts at the same time. While many editors do have this feature, it is especially great for PowerShell.

image

The final feature I want to mention is Bookmarks. We’ve all had big scripts where we are working on a section of code, need to go look at something elsewhere in the code, then need to jump back to the previous line we were working on. It is useful, then, to drop a bookmark, scroll down to the code you want to look at, then quickly jump back.

image

Using the Bookmark menu you can place a marker in your code. Over to the left of the editor you’ll see the marker.

image

Now you can scroll down and find the other piece of code you want to look at. If it is something you’ll want to come back to continually, you can place a second bookmark. Then using the Next/Previous bookmark buttons you can easily jump back and forth between the two locations in your code.

image

While these are features that come with some editors, such as Visual Studio, they are certainly lacking in the PowerShell ISE. These are basic but critical features that make you much more productive when developing your own PowerShell scripts.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: