Skip to content

Ignore problems on commented out line #1253

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

Closed
roblourens opened this issue Mar 31, 2018 · 4 comments
Closed

Ignore problems on commented out line #1253

roblourens opened this issue Mar 31, 2018 · 4 comments

Comments

@roblourens
Copy link

From @ixixit on March 2, 2018 23:5

Issue Type

Bug

Description

Hello! In this powershell script, I've created an if block which is commented out, and has no statement block following it. It is correctly detected as a comment line in the syntax, but the problem section reports it as an active problem, though it is not active in the script due to the # comment block.

# if ((Get-ChildItem -Path "$LogDir\$TempDir" -File -Recurse -Exclude '*.zip' | Measure-Object | ForEach-Object {$_.Count}) -ne 0)
if ((Test-Path -Path "$LogDir\$TempDir" -PathType Container) -And ((Get-ChildItem "$LogDir\$TempDir" -File -Recurse | Measure-Object | ForEach-Object{$_.Count}) -gt 1))
{
    $FileCount =  (Get-ChildItem -Path "$LogDir\$TempDir" -File -Recurse | Measure-Object | ForEach-Object{$_.Count})
}

Problems: [Powershell] Missing statement block after if (condition).

Secondly, if I create a second if line afterwards, and reverse the comment block, problems says there are no problems!

if ((Get-ChildItem -Path "$LogDir\$TempDir" -File -Recurse -Exclude '*.zip' | Measure-Object | ForEach-Object {$_.Count}) -ne 0)
# if ((Test-Path -Path "$LogDir\$TempDir" -PathType Container) -And ((Get-ChildItem "$LogDir\$TempDir" -File -Recurse | Measure-Object | ForEach-Object{$_.Count}) -gt 1))
{
    $FileCount =  (Get-ChildItem -Path "$LogDir\$TempDir" -File -Recurse | Measure-Object | ForEach-Object{$_.Count})
}

Problems: No problems have been detected in the workspace so far.

If I revert to the original condition, and remove the active if line, problems reports an unexpected else, which is correct, but not illustrated in this example..

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9137d24d36d968ea6b2911786bfe103002, 2018-02-13T15:34:36.336Z)
OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2808)
Memory (System) 15.79GB (10.88GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader no
VM 57%
Extensions (1)
Extension Author (truncated) Version
PowerShell ms- 1.6.0
Reproduces without extensions

Copied from original issue: microsoft/vscode#44954

@roblourens
Copy link
Author

From @ixixit on March 5, 2018 15:54

Sorry about the font sizes. Not sure why that particular IF line went crazy.

@ixixit
Copy link

ixixit commented Mar 31, 2018 via email

@TylerLeonhardt
Copy link
Member

Hi @ixixit, thanks for the report and thanks to @roblourens for bringing it over here!

Can you supply us with the logs when you see this issue? The info on how to do that is here:
https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

It's super important to set the logs to Verbose. If you can set the logs to Diagnostic, that'd be even better if it's ok on your performance!

@TylerLeonhardt
Copy link
Member

I can't seem to repro this but it looks related to #1232

I'm going to close this as a dupe of that. If you see otherwise, feel free to attach the logs here and I can reopen!

(or attach logs in the other issue)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants