PowerShell / PowerShell/PSScriptAnalyzer

whitespaceBeforeOpenParen does not add a space between param and paren

Open
#1,303 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue - Question
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

System Details Output

  • Operating system name and version
    Windows 10 build 1903
### VSCode extensions:
ms-vscode.powershell@2019.5.0
ms-vscode.vs-keybindings@0.2.0


### PSES version:

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.18362.145
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.145
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
Issue Description

I am experiencing a problem with the "powershell.codeFormatting.whitespaceBeforeOpenParen" setting.

Expected Behaviour

When formatting a PowerShell document, a space should separate the "param" keyboard and the following open paren "(".

Actual Behaviour

When I format a PowerShell document (press Ctrl + K; Ctrl + D), a space is not inserted bewteen the "param" keyboard and the open paren "(".

Attached Logs

Attached logs.zip

Proof of Concept/Example Code

Attached Test-WhitespaceBeforeOpenParen.zip
logs.zip
Test-WhitespaceBeforeOpenParen.zip

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 with the powershell.codeFormatting.whitespaceBeforeOpenParen setting and reproduce the issue using the attached Test-WhitespaceBeforeOpenParen.zip example, formatting with Ctrl + K; Ctrl + D. Compare the expected and actual output, and use the logs.zip attachment if needed. Done means formatting inserts a space between the param keyword and the opening parenthesis.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.