PowerShell / PowerShell/PowerShellEditorServices

Allow customization of code formatting rules

Open
#552 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Script Analysis Issue-Enhancement
Dominant language
C#
Stars
767
Forks
266
Avg merge
3d 16h
Merged PRs (30d)
1

Description

In this block of code: https://github.com/PowerShell/PowerShellEditorServices/blob/master/src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs#L209

The list of PSScriptAnalyzer rules used to perform the Formatting function is hard-coded. It would be nice to have a way of extending this list to include custom rules. For example, I have one that removes any trailing whitespace from lines, but it doesn't run if I use VSCode's "Format Document" or "Format Selection" actions.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/PowerShellEditorServices.Protocol/Server/LanguageServerSettings.cs at the formatting-rule list around line 209. Trace how that list is used by the Format Document and Format Selection actions, then determine how custom PSScriptAnalyzer rules should be supplied and included in both paths. Done means users can extend the formatting rules and their custom rule runs through those editor actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.