vscode-powershell
vscode-powershell copied to clipboard
Comment-Based Help after function name indents improperly on "Format Document"
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all issues to ensure it has not already been reported.
- [X] I have read the troubleshooting guide.
- [X] I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
- [X] I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
- [X] 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
[email protected]
Steps to Reproduce
- Create Function
- Comment based help on same line as function
- Format document or format-on-save
Visuals
https://user-images.githubusercontent.com/15258962/163913559-fd6f3949-1f40-433f-820b-6e81e995711c.mp4
Logs
No response
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?
Hopefully fixed now.
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
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.
@andschwa FYI still happening in v2022.4.2
Thought it would, sorry! Huge blocker?
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.