PowerShell Studio 2016 is released! We’ve written a series of blog posts to introduce you to the newest features. In this blog, Part 3, we will look at some of the new editor features of PowerShell Studio 2016.
But, there’s more:
- In Part 1, we review the new UI features, including our new dark themes.
- In Part 2, we introduce our new debugging features, including variable and function breakpoints and improvements to the Variables pane.
- In Part 4, we show the new customizable PrimalSense in PowerShell Studio 2016.
PowerShell Studio already allowed you to convert functions into a new module (File->New->New Module from Functions). Now, with PowerShell Studio 2016, you can import functions into your existing scripts or modules.
You can find the Import Functions feature in the Edit group in the Home tab of the ribbon:
Or in the Functions panel:
You’ll be prompted to select the files that contain the functions. You can select and remove files at any time. All functions in the files will be listed in the Import Functions dialog box.
To insert the checked functions in the script, press the Import button.
Code Folding Options
PowerShell Studio supported collapsible code in the form of regions, multiline comments, and script blocks. PowerShell Studio 2016 lets you control which regions collapse and expand when you use the collapse / expand commands.
To select collapsible regions, in the Edit group on the ribbon, click Regions, and then click Include.
New Code Formatting Options
We added two new formatting options.
Automatically expand aliases
When enabled, this option expands command and parameter aliases when formatting your script.
Convert curly quotes to straight quotes
When enabled, this option automatically replaces curly quotes (blog quotes) with straight quotes when formatting your script.
TODO / DONE Tasks comments
When creating event handlers for PowerShell GUI applications, you might have noticed that a TODO: comment is included:
These comments are meant to be reminders that you have to place your custom script in the event script block.
To help you find these uncompleted tasks, PowerShell Studio will display the TODO: comments in the Navigation menu that is located in the upper right corner of the Script tab:
DONE: comments will appear in the Navigation menu as you complete the tasks.
To quickly jump directly to these task comments in your script, select them from the Navigation menu.
New Document Tab Commands
PowerShell Studio 2016 adds a few new commands to the context menu that appears when you right click the tab for a file:
Copy File Name
Copies the file name to the clipboard.
Copy Folder Path
Copies the file folder path to the clipboard.
Reloads the document, undoing any unsaved changes.
For your convenience, we moved all PrimalSense-related options to their own Options page:
Separating these options declutters the Editor page and makes it easier for you to find the settings you are looking for.
Now, all the auto-insert options are grouped in one convenient location.
PowerShell V2 Compatibility
In build v5.2.116, we introduced a new option (Options->Designer): Enable PowerShell V2 assembly compatibility.
When this option is enabled, PowerShell Studio will use .NET 2.0 assembly references when generating GUI scripts and will warn you if any assembly does not support the .NET 2.0 Runtime.
You can access the file’s assemblies using the Ribbon->Home->Edit->Assemblies:
If the option is unchecked, it will use the 4.0 .NET or later assemblies and place a #requires –Version comment at the top of the generated script.
Next we will look at PowerShell Studio 2016’s new Custom PrimalSense feature.