Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
6 tasks done
JustinGrote opened this issue Apr 19, 2022 · 7 comments
Open
6 tasks done
Labels

Comments

@JustinGrote
Copy link
Collaborator

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

Demo.mp4

Logs

No response

@JustinGrote JustinGrote added the Issue-Bug A bug to squash. label Apr 19, 2022
@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 19, 2022
@JustinGrote JustinGrote added Area-Code Formatting and removed Needs: Triage Maintainer attention needed! labels Apr 19, 2022
@andyleejordan
Copy link
Member

Isn't comment-based help supposed to go above the function, not in the function definition? Anyway, this looks like a PSSA issue, can you repro it using PSSA directly to format?

@andyleejordan
Copy link
Member

Hopefully fixed now.

@JustinGrote
Copy link
Collaborator Author

JustinGrote commented Apr 20, 2022

Isn't comment-based help supposed to go above the function, not in the function definition? Anyway, this looks like a PSSA issue, can you repro it using PSSA directly to format?

3 locations are supported, with "below the function keyword" being the conventional default (this differs from the C#/Typescript XMLDoc/JSDoc norm of above the function declaration)

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help?view=powershell-7.2#syntax-for-comment-based-help-in-functions

@andyleejordan
Copy link
Member

Ah, good to know! I'm not sure why this would be fixed by the last PR, just that it seemed so during a triage meeting. I'll try to repro and test.

@andyleejordan andyleejordan reopened this Apr 20, 2022
@JustinGrote
Copy link
Collaborator Author

@andschwa FYI still happening in v2022.4.2

@andyleejordan
Copy link
Member

Thought it would, sorry! Huge blocker?

@JustinGrote
Copy link
Collaborator Author

Thought it would, sorry! Huge blocker?

Not for stable RC, minor annoyance at best, you can always "save without formatting" or just move it above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants