-
Notifications
You must be signed in to change notification settings - Fork 382
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
Multiline formatting does not indent correctly #1290
Comments
(This might be fixed in PSSA 1.18.1, which you can test with |
I ran that in PowerShell and then restarted VSCode. Same issue. I've attached a file with the code as formatted. (Renamed to .txt extension so that GitHub will allow upload) |
Whilst I can confirm this still happens on the latest version, I'd argue it is not a valid use case because the backtick is not needed when using pipelines. foo | `
# hello world
baz However, not using backticks does not cause this malformatting: foo |
# hello world
baz What you observed is because ScriptAnalyzer increases the indentation per backtick and optionally for pipelines as well depending on the foo `
#comment
-bar |
Ah! The problem was that I wasn't aware of the PipelineIndentation setting! Now that I am, it does what I expect, other than your final case. (Which is the same issue as my final case, I think) Thank you! |
Any idea why pipelines don't default to "IncreaseIndentationForFirstPipeline", which is what I'd expect? (i.e. a visual indication that the later lines are a continuation of the first one) That's what the info at https://devblogs.microsoft.com/powershell/powershell-scriptanalyzer-version-1-18-0-released/ indicates it was going to do. Edit: Never mind, found https://devblogs.microsoft.com/powershell/release-of-powershell-script-analyzer-1-18-1/ |
The new |
Issue Description
I am experiencing a problem with formatting of multiline commands. Particularly with comments in them. Given the following command, this is how Powershell formats it:
If I put in backticks then the formatter notices:
which is what I would expect.
However, if I then put in comments I get:
Which doesn't look right to me.
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
The text was updated successfully, but these errors were encountered: