-
Notifications
You must be signed in to change notification settings - Fork 366
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
Bad formatting of call operator line #1435
Comments
The syntax highlighting (coloring part of the command as a comment) is handled by the https://github.com/powershell/editorsyntax project. Please file an issue there for that issue. But yeah, the code-formatter shouldn't be adding spaces after the commas in this case. To be honest, I'm surprised this actually works at all given that
@kapilmb With the spaces added, the above invocation changes significantly to this:
|
Considering the problem a bit more, determining whether something is a native executable or not can only be done at runtime -- it's not something we can reliably do in PSScriptAnalyzer. However, formatting an array is a very common scenario and I'm not sure it's possible for us to fix this without disabling array space insertion. Basically trying to fix this without breaking other formatting scenarios is going to be fragile at best, and likely not possible in arbitrary cases. My current recommendation would be to either:
In future, we'll probably seek to address this with comment-based rule suppression (like with other linters). |
System Details
Version 1.14.2
Commit cb82febafda0c8c199b9201ad274e25d9a76874e
Date 2017-07-19T23:34:09.706Z
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0
$PSVersionTable
:Issue Description
The following line is incorrectly formatted:
VS Code treats the first "#" as the start of a comment, whereas it really is just a part of the command arguments passed to the call operator. Furthermore, VS code formats the line by adding spaces after the commas, which breaks the command.
The text was updated successfully, but these errors were encountered: