-
Notifications
You must be signed in to change notification settings - Fork 500
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
Change Whitespace settings to camelCase #1867
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except the PR title is not quite right. It should be change to camelCase from PascalCase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I've been trying to test this and the settings don't do anything. They also don't do anything in our current release. I've verified in the debugger that we send the right settings through, and also verified that the problem doesn't occur with |
Any chance you could have an earlier version of PSSA loaded? |
|
Hmm, nope, that's not the problem. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for correcting this. It would be great if the casing could also be changed in PSSA's release blog post that describes the new vscode settings:
https://devblogs.microsoft.com/powershell/powershell-scriptanalyzer-version-1-18-0-released/
Script is: gmo|
? {$_.IsDuck }|
git Settings include: "powershell.codeFormatting.whitespaceAroundPipe": true, At that point Shift+Alt+F does nothing in the program. However, I've just realised while looking at it that this might be a problem in the client. I'm seeing this error when I send that key chord:
Going to look into that now |
Ok, interesting. I use Ctrl + K + F to format. |
Fixing that warning didn't help |
@rjmholt I tried your example and I think it is due to the (default) setting of |
Examples you gave aren't working either unfortunately. I'm stepping through in the debugger and have the following: So as far as I can tell it's calling Invoke-Formatter -Settings @{
Rules = @{
PSPlaceCloseBrace = @{ NewLineAfter = $false; IgnoreOneLineBlock = $true; Enable = $true }
PSUseConsistentWhitespace = @{
Enable = $true
CheckInnerBrace = $true
CheckOperator = $true
CheckPipe = $true
CheckOpenParen = $true
CheckSeparator = $true
CheckOpenBrace = $true
}
PSAlignAssignmentStatement = @{ CheckHashtable = $true; Enable = $true }
PSUseCorrectCasing = @{ Enable = $false }
PSPlaceOpenBrace = @{
NewLineAfter = $true
IgnoreOneLineBlock = $true
Enable = $true
OnSameLine = $true
}
PSUseConsistentIndentation = @{
Enable = $true
PiplineIndentation = $true
Kind = 'space'
IndentationSize = 4
}
}
IncludeRules = @(
'PSPlaceCloseBrace'
'PSPlaceOpenBrace'
'PSUseConsistentWhitespace'
'PSUseConsistentIndentation'
'PSAlignAssignmentStatement'
)
} -ScriptDefinition @'
if ($true) {foo}
foo|bar
'@ Running that on my machine in the console gives me:
I also get that result inside PSES and then that gets returned. So it looks like it's the |
Here is the verbose output:
|
More data:
|
Ok I've just reinstalled PSScriptAnalyzer and it's working now. I suspect I somehow had a bad build. |
Sorry about all that @bergmeister! :) |
* Set settings to camelCase * Update settings interface
No worries, I created an issue in PSSA to capture your special multi-line case whereby together with the set of settings, the formatting does not work exactly as expected |
No description provided.