PowerShell / PowerShell/PSScriptAnalyzer

Add support for space handling after opening and before closing non-empty parenthesis/brackets/braces.

Open
#1,583 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Configuration Area - Formatter Issue - Enhancement Up-for-Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Summary of the new feature

Add functionality to allow the user to control adding spaces after opening and before closing non-empty parenthesis/brackets/braces.

For example:

(a + b) = c ==> ( a + b ) = c

if ($MyVar -eq $true){ } ==> if ( $MyVar -eq $true )

[OutputType([string])] ==> [ OutputType( [ string ] ) ]

Proposed technical implementation details (optional)

The TypeScript extension has the following options:

// Defines space handling after opening and before closing non empty parenthesis.
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,

// Defines space handling after opening and before closing non empty brackets.
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,

// Defines space handling after opening and before closing non empty braces.
"typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true,

// Defines space handling after opening and before closing template string braces.
  "typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,

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

The issue names no files or tests. Start by tracing existing PSScriptAnalyzer formatting options and comparing them with the listed TypeScript settings. Done means users can independently control spaces after opening and before closing non-empty parentheses, brackets, braces, and template string braces, with the shown examples covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
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.