PowerShell / PowerShell/vscode-powershell

The snippet "Parameter: Suppress PSScriptAnalyzer Rule" is missing a closing quote and comma

Open
#4,911 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug Up for Grabs
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

When using the snippet to suppress a PSScriptAnalyzer rule on a parameter, there is no closing quote or comma after the parameter name field.

Additionally, when tabbing through the snippet, the parameter name field and the justification field are both selected at the same time, though this doesn't bother me nearly as much so no objections if there's a reason it needs to stay that way.

PowerShell Version
> $PSVersionTable;$Host       

Name                           Value
----                           -----
PSVersion                      5.1.19041.3930
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3930
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Name             : Visual Studio Code Host
Version          : 2024.0.0
InstanceId       : 81fc513a-022e-4fba-82ec-06feefb556d3
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
> code --version
1.86.0
05047486b6df5eb8d44b2ecd70ea3bdf775fd937
x64
Extension Version
> code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2024.0.0
Steps to Reproduce
  1. Open a new or existing powershell file
  2. Open the command palette (e.g., ctrl+shift+P)
  3. Type "Snippets: Insert Snippet" and press enter
  4. Search for "suppress-message-rule-parameter" and press enter
  5. Snippet is inserted with missing quote and comma
Visuals

image

Logs

No response

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

Locate the suppress-message-rule-parameter snippet in the extension's snippet definitions and reproduce it through Snippets: Insert Snippet in a PowerShell file. Done means the inserted snippet has the missing closing quote and comma after the parameter name, with the reported tab-stop behavior checked as well.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.