-
Notifications
You must be signed in to change notification settings - Fork 677
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
Update diagnostics when focusing an editor (DiagnosticsProvider is lazy) #2317
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2317 +/- ##
==========================================
+ Coverage 59.79% 59.85% +0.06%
==========================================
Files 83 83
Lines 3768 3774 +6
Branches 547 549 +2
==========================================
+ Hits 2253 2259 +6
- Misses 1347 1348 +1
+ Partials 168 167 -1
Continue to review full report at Codecov.
|
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.
Looks like a good change @SirIntruder. Thanks!
@SirIntruder Thanks for your contribution. I pulled your branch and realized that because we have the |
I added onDidChangeWindowState as support for alt tabbing - that is useful for when you make changes from outside vscode and return, in my case usually git pull. I checked focus flag so it should not send request on minimizing or closing, but I was not aware it is invoked on resize as well. I could add a tracking flag so it would only be sent when focused is actually changed from false to true, would that be ok? |
@SirIntruder I set a breakpoint on https://github.com/OmniSharp/omnisharp-vscode/pull/2317/files#diff-f7f698ea628a7fd476ec3cd2355e1927R163 and it is being hit on minimize and closing as well. Can you try that? |
@akshita31 It looks like I always get two onDidChangeWindowState events when I debug from vscode - always one windowState.focused === false, one windowState.focused === true. It looks like it is just issue with focus jumping to debugger and back. When I turned breakpoint into logpoint, it worked as you would expect (true only when returning to focus.) I didn't debug this before, I compiled it with tsc and was printing out some logs to see what is going on - and according to logs it works like it should (focused == true only when returning to focus). |
@SirIntruder Thanks for the analysis. Looks good to me. |
Thanks very much for the contribution @SirIntruder! |
I noticed I often have to insert random whitespace for vscode to update error reports, so I checked what extension is doing.
Currently, extension updates diagnostics on two events: onDidChangeTextDocument and onDidOpenTextDocument. onDidOpenTextDocument is called only when first openning an editor for a file (docs). If you modify a file "A.cs":
This PR would add two vscode events: onDidChangeActiveTextEditor and onDidChangeWindowState, and call the same pathway as onDidOpenTextDocument/onDidChangeTextDocument when user focuses an editor. This both fixes issue with huge projects (without any project wide check, just updates info for the newly focused document) and makes diagnostics as snappy as possible.
Additional requests this PR would introduce are already invoked on every keystroke anyway, so server load should not increase meaningfully.