PSSharper

Datetime:2016-08-23 03:58:21          Topic: WPF           Share

We just releasedISESteroids 2.5.2.0. This is a major release. It comes with two big new features: PSSharper and improved WPF handling . Let’s take a look at PSSharper first, and then scratch the new WPF support.

Visual Enhancements

PSSharper is a suit of features designed to find issues in your code. To do this in an unobtrusive way, we added visual clues. Some of these clues are generic. For example, ISESteroids displays links and paths with an underline, and when you hold CTRL, you can click these links and navigate to the target.

This works in comments and strings. In comments, you can also add the keyword “TODO:”. ISESteroids highlights these lines so you can easily add important comments and todo lists.

Variable Analysis

Many issues in PowerShell center around variable usage. This is why PSSharper analyzes the use of variables in real-time.

You will see dimmed, highlighted, and striked-through variables. When you hover over such a variable, a tooltip provides more information. If you don’t like tooltips, open the new menu PSSharper , and turn them off. They will then only show when you hold CTRL while you hover over an item.

  • Reserved Variables: Sometimes, you find yourself assigning values to reserved system variables. ISESteroids marks this with Strike-Through adornments,
  • Unassigned Variable: If you try and use a variable before it was assigned a value, it is ghosted.
  • Suspicious Assignment: If you assign a variable that is never used, the variable is ghosted. If the variable is used in a different scope, or before the assignment takes place, the variable is marked yellow. Again, a tooltip clarifies why ISESteroids adds these adornments,

Parameter Analysis

Parameters are also evaluated, and when you do not assign a default value to an optional parameter, the parameter is ghosted.

Parameter attributes are also evaluated, and when you assign a default value to an attribute value, such as $Mandatory=$true, the default part “=$true” is ghosted.

Other PSSharper Components

Aside from the visuals you just saw, PSSharper now cleanly combines a set of features that was present in previous versions of ISESteroids already. When you open the menu PSSharper, you can control squiggles, visuals, and tooltips. You can also directly invoke a batch-formatting of your script that fixes the most common formatting problems and nicely pretty-prints your code.

In addition, with “Pester Integration” you control the Pester overlays that ISESteroids displays for functions. And Settings provide more control over the underlying rules and subsystems.

WPF Support and Creating UIs

The other big thing in this release is the new WPF support that makes creating WPF UIs a snap. Here is how to start:

Right-click an empty spot in your ISE editor, then in the context menu, choose “WPF/Create WPF Sample Window”. This adds all the code for a fully-functional dialog window.

Next, scroll up to the XAML definition. ISESteroids adds convenient overlay controls that allow you to update the code-behind, add more event handlers, or edit the window design in your favorite tool.

Once you edited the XAML there, ISESteroids picks up the changes automagically once you close the WPF editor.

What’s Next?

PSSharper is a work in progress, and there will be much more added in the future. For this release, it was our goal to add some useful visual clues. The next feature will be deep code analysis with advanced refactoring.

If there is anything not working as expected, or if you have additional ideas, let us know! Contact us via oursupport page!





About List