-
Notifications
You must be signed in to change notification settings - Fork 513
PowerShell: Non-standard verb causes squiggly lines throughout entire function #132
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
Comments
Which version of the extension are you using? I can't duplicate this with 0.5.0. There was an update to PSScriptAnalyzer to address this issue for a few rules (using approved verb was one of those). That updated version of PSScriptAnalyzer got pulled into the 0.4.1 release. So with 0.4.1 and higher, you shouldn't see this issue. |
I was speaking to Trevor about this on the original Microsoft/vscode issue, we confirmed that he's using 0.5.0. That's really confusing because like you say, this issue has been fixed for a while now. In this case it seems like the old PSScriptAnalyzer rules assembly is being used but I'm not sure how that's even possible... |
@pcgeek86 Can you repro the problem and then grab the handle SysInternals tool. Open an elevated prompt and run That will tell us the path of the ScriptAnalyzer dll that is loaded into the PSES host. It would also help to only have one VSCode instance running when you do this. Thanks. |
@rkeithhill @daviwil Here you go folks -- any thoughts? |
I'm able to re-produce it as well; C:\Users\Damien.vscode\extensions\ms-vscode.PowerShell-0.5.0\bin\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll |
OK I can repro it now. BTW as soon as I put one blank line before this function definition, we start getting back the correct extent from PSScriptAnalyzer. Weird, bizarre and quite strange also. |
@rkeithhill Nice -- glad the repro worked out. /cc @dsolodow |
Seems to be a bug in the rule, I can repro it also if I define the function at the very top of the file without a newline before it. Nice catch Trevor and Damien! I've filed an issue (PowerShell/PSScriptAnalyzer#492) so the PSScriptAnalyzer team can take a look. |
@kapilmb has already got a fix prepared for this issue: PowerShell/PSScriptAnalyzer#495. It'll be in the next PSScriptAnalyzer update. I'll see if we can sync that up with the next VS Code extension release. I'll keep this bug open until we verify that it works on our end for the next release. |
Still waiting on a new PSScriptAnalyzer update before this issue can be fixed. I'm going to bump this to 0.7.0 under the condition that 0.7.0 will come out soon after 0.6.0 and be primarily focused on a couple of PSScriptAnalyzer-related improvements. |
@kapilmb do you know if the ShouldProcess rule has also been fixed with the extent checking that doesn't make it mark the whole file? |
@ian-moore Is this the first function in the file? If so, as a workaround, put a blank line before the function. You also see to have a file encoding issue as indicated by the |
This appears to be PSShouldProcess rule violation. As of now, the violation extent of this rule marks the entire function :( - https://github.com/PowerShell/PSScriptAnalyzer/blob/development/Rules/UseShouldProcessCorrectly.cs#L67 |
I'm not exactly sure what I updated today, but I no longer receive the warning, even before removing the invalid character. Thanks for the help though! |
This one has been fixed for a while, just forgot to close the bug! |
Steps to Reproduce:
@daviwil
Cheers,
Trevor Sullivan
https://trevorsullivan.net
https://twitter.com/pcgeek86
microsoft/vscode#4816
The text was updated successfully, but these errors were encountered: