Skip to content

Error/warning detection is randomly broken #1232

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
gradinkov opened this issue Mar 19, 2018 · 16 comments
Closed

Error/warning detection is randomly broken #1232

gradinkov opened this issue Mar 19, 2018 · 16 comments
Assignees
Labels
Area-IntelliSense Issue-Bug A bug to squash. Issue-Performance Something's slow.

Comments

@gradinkov
Copy link

gradinkov commented Mar 19, 2018

Repro:

  1. open VS Code
  2. ctrl+n, ctrl+s, save as foobar.ps1
  3. paste: $test = @{ "item1" = @("foo"); "item1" = @("bar") } then ctrl+s
  4. unused warning for $test, and duplicate keys error for second item1 won't appear
  5. open a new line, type write-host "hello" and save, then the warning and error should appear.
  6. empty whole first line, ctrl+s, red error underline remains on empty char 1
  7. paste $test = @{ "item1" = @("foo"); "item2" = @("bar") }, now error is displayed after the closing brace
  8. you can keep randomly bugging it out, sometimes it will display a duplicate error for unique keys, sometimes it won't show an error for duplicate keys. Sometimes opening a new line will fix it, sometimes it won't. Sometimes adding a new statement on a new line, then saving fixes it, sometimes it won't. It gets worse the more statements and braces you have. Sometimes if you delete a block (if, while, switch, etc.), the error jumps to the next closing brace, or the previous opening brace, and so on and so forth. And of course it's not just duplicate keys or unused variables, any kind of syntax problem will occur and stick around even if you fixed it long ago.

Happens to me all the time on at least 3 different computers (2 desktops, 1 laptop; 1 in domain, 2 in workgroup).

Windows 10 1709 16299.309
VS Code 1.21.1
PowerShell 6.0.2
PowerShell Extension 1.6.0

Basically any version that's been released since January, it happens on all of them, constantly.

@gradinkov
Copy link
Author

It could be that I write code that's not too conventional and too prone to mess up IntelliSense, I really dunno. I'm a PowerShell noob, this is my first shot at it. Maybe just writing invalid code in rudehash.ps1, then fixing it will trigger this more easily. To me it happens every few minutes, which gets really irritating after a while.

@gradinkov gradinkov changed the title Error and warning detection is randomly broken Error/warning detection is randomly broken Mar 19, 2018
@TylerLeonhardt
Copy link
Member

Totally understandable and thank you so much for opening this! I couldn't repro what you are seeing on my mac but let me try a few other VMs and get back to you.

@joeyaiello
Copy link

@tylerl0706 and I talked, this might have something to do with the size of the flat .ps1 you're working with on you project. But it's certainly not the biggest .ps1 I've ever seen (here's what PowerShellGet looked like before a recent refactor), so it's reasonable that we should work better with larger files like that.

@gradinkov
Copy link
Author

But it also happens with my 2 line example...

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Mar 20, 2018

I've been speaking with @SeeminglyScience about this and he had some thoughts on why this was happening. Even for small files. It's entirely possible that the bigger the file, the more common this issue is which is why "large file" is quick to blame.

I'll continue investigating.

@gradinkov
Copy link
Author

gradinkov commented Mar 20, 2018

I C, that might very well be the case indeed. Thanks a lot for the quick responses, really appreciate it.

@moymike
Copy link

moymike commented Mar 20, 2018

@gradinkov
Copy link
Author

gradinkov commented Mar 20, 2018

Definitely almost identical, tho I don't think closing and reopening the file ever solved this issue for me. Only a full Code restart.

@TylerLeonhardt
Copy link
Member

This is one of my main focuses next week. I'll keep you updated.

@TylerLeonhardt TylerLeonhardt self-assigned this Mar 25, 2018
@rkeithhill
Copy link
Contributor

I can repro on PS Core 6.0.2 but not with Windows PS 5.1.

@TylerLeonhardt
Copy link
Member

I'm going to clone RudeHash and try to repro this on a couple OS's.

@gradinkov
Copy link
Author

Thanks a lot, really appreciate it!

@TylerLeonhardt
Copy link
Member

Hey everyone, I'm having a super hard time repro'ing this. I won't stop trying, but if you DO run into this issue, please grab the logs and drop them here so I can take a look. It'll be really helpful. Thanks!

@gradinkov
Copy link
Author

Exactly what kind of log?

@TylerLeonhardt
Copy link
Member

We have some instructions here:
https://github.com/PowerShell/vscode-powershell/blob/master/README.md#2-capture-verbose-logs-and-send-them-to-us

It also includes turning on Verbose logs that is crucial. Diagnostic would be even better if it doesn't affect performance.

@SydneyhSmith
Copy link
Collaborator

Closing this issue as inactive, will re-open if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IntelliSense Issue-Bug A bug to squash. Issue-Performance Something's slow.
Projects
None yet
Development

No branches or pull requests

7 participants