| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
since this is definitely improving the current experience, this isn't a blocking comment or one that requires a change, but I think this can go a bit further.
Sorry, something went wrong.
| Invoke-Formatter '$foo.bar(-$a)' -Settings CodeFormatting | Should -Be $script | ||
| } | ||
|
|
||
| It "Should expand unary operators when not being used as a single negative argument" { |
There was a problem hiding this comment.
i'm not sure it's not just parens where this be applied. Take the following:
PS> Invoke-Formatter -ScriptDefinition '$r = $a -lt -$var' $r = $a -lt - $var
shouldn't that be $r = $a -lt -$var?
Sorry, something went wrong.
There was a problem hiding this comment.
I agree with you. I extracted this into the new issue #950 to separate concerns and finish this PR. I am sure there are other special cases as well but I guess the best approach is to find them one by one and find heuristics to detect each case I suppose.
Sorry, something went wrong.
…nalyzer into formatter_unaryOperator
…ter/PSScriptAnalyzer into formatter_unaryOperator
| Back | FazBrowse Home | New Git URL |
PR Summary
Fixes #847
When an expression like $foo.bar(-$Var) is present, then the UseConsistentWhiteSpace should not expand spaces around this expression.
This works by checking if the - operator is an unary operator, is preceded by an open parenthesis and followed by a variable.
PR Checklist
Note: Tick the boxes below that apply to this pull request by putting an x between the square brackets. Please mark anything not applicable to this PR NA.