Home Blog Customizing PSSharper Adornments
 

Customizing PSSharper Adornments

In a previous post, we introduced the new real-time analysis engine “PSSharper”. We received a lot of good feedback. Some of you would like to change the adornments, and here is how you do this.

If you don’t like “ghosted” variables…

When PSSharper detects an issue, it uses adornments right in your code to alert you. The factory default adornments can be squiggles and/or text formats. For example, if you assign a new variable, but the variable is not used anywhere in your code, the variable appears “ghosted“:

ghosted variable

Some of you like the rule but don’t like the adornment. With their color schemes, the “ghosted” format looks a bit like a pastel color and might be hard to read or even confusing.

…just change it and make it “Your Style”!

You have two options to work around this:

  • Disable the rule altogether:┬áThis removes all adornments for this issue, and places the issue in the category “Ignored Rules”
  • Change the adornment: Pick a different adornment, or turn off adornments altogether. The rule itself remains active and will continue to show up in the PSSharper Bar.

To change the adornment for any issue, click the adornment in your code. In the example above, for example, click the “ghosted” variable. In the margin, a light bulb appears. Click it to see PSSharper options. Click “Manage Issue…”.

Manage Issue

This brings up the PSSharper addon, and the issue is selected for you. Just make sure it is the correct issue: the one you want to customize. Sometimes, there are multiple issues in one location, so the addon may not show the issue you are after. If that is the case, click the buttons on the PSSharper Bar to view the other categories, until you find the issue you want to customize.

Next, click the “gear” icon in the red issue header. This opens a menu with all of your options to customize all instances of this particular issue.

Customizing Issue Adornment

To disable all instances of this rule altogether, choose “Ignore this rule“. This may not be a good option, though, because you probably still want PSSharper to evaluate this rule. You just don’t want the ghosted appearance.

So if you just want to remove the “ghosted” variable appearance and keep the rule active otherwise, choose “Personalize“, then “Text Format“, then “No Format“. This removes the ghosted appearance.

Turning Off Ghosting

If you like, you can add a squiggle instead (use the same steps, and choose “Squiggle Type”, then the type of squiggle) or leave the issue without an adornment. When an issue has no adornment, it will not change your source code appearance, but the issue will still be reported in the PSSharper Bar.

Create Custom Config

All customizations you apply to PSSharper can be saved in configuration files. This way, you can easily copy them to other machines, or use different configurations for different purposes.

To save your current customizations, click the arrow button in the upper right corner of the PSSharper addon.

Save PSSharper Config

When you have saved one or more custom PSSharper configurations, the menu shows the saved configs so you can easily switch between them. Choose “Manage Configurations” (in the screenshot hidden behind the tooltip) to open the folder where the configurations are stored.

You can easily copy these files to another machine, and if you use the ISESteroids ZeroTouch mode (where your personal settings are stored inside the module folder itself, and might have stored the module on your OneDrive cloud storage), your configurations are available on every machine where you load ISESteroids from your OneDrive.

If you want to return to factory defaults, use “Restore Factory Default“. This removes all customizations, so make sure you saved them before if you care about them.