PowerShell / PowerShell/vscode-powershell

Comment-Based Help after function name indents improperly on "Format Document"

Open
#3,926 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Code Formatting Issue-Bug
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 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

Comment block indents during formatting when it shouldn't. Doesn't occur if block is above the function or if the whole block is already indented.

PowerShell Version
Latest
Visual Studio Code Version
1.67.0-insider
e6d98a13fcd3bf928d0e755eaae873ac200a98bd
x64
Extension Version
ms-vscode.powershell-preview@2022.4.1
Steps to Reproduce
  1. Create Function
  2. Comment based help on same line as function
  3. Format document or format-on-save
Visuals

https://user-images.githubusercontent.com/15258962/163913559-fd6f3949-1f40-433f-820b-6e81e995711c.mp4

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

Reproduce the issue in the PowerShell extension using a comment-based help block on the same line as a function, then apply Format Document and format-on-save. Trace the formatting behavior responsible for the incorrect indentation and verify that the block remains correctly positioned without regressing the cases described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.