-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Mark diagnostics as being 'live' or not in LSP #70402
Conversation
// Mark this also as a build error. That way an explicitly kicked off build from a source like CPS can | ||
// override it. | ||
if (!isLiveSource) | ||
result.Add(VSDiagnosticTags.BuildError); |
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.
@mavasani should isLiveSource = false
always imply potentialDuplicate
?
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.
What is the implication of adding PotentialDuplicate
tag? Does it mark it for de-duping?
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.
Taking offline to discuss.
@CyrusNajmabadi overall LGTM, though I'd want to confirm if you are able to validate the exact 4-step scenario mentioned in the PR description works fine after this PR. |
I think this only works if msbuild & Roslyn use the same identifier/hashing for diagnostics. LSP & Build diagnostics are two unrelated sources, so the client can only dedupe if the diagnostics reuse the same identifier string. |
@adrianvmsft was doing the work to ensure we had the same ID i believe. Did that work go in @adrianvmsft ? Do we still need to do anything there to ensure we're doing things the same way? |
Merging in. We still want this so that "run code analysis" results show up in the 'build' tab. Deduping isn't currently needed because when a build is kicked off we will clear out these results. We can consider further improvements in this area if desired (balanced against cost/complexity). |
This allows the LSP client to know how to treat diagnotics that we produce against those that may be produced from other 'non-live' source (like CPS).
Specifically, this ensures that if the user does the following steps that they get the right results:
Currently, roslyn continues to report the results of '2' for the "last computed workspace results" when queried for workspace diagnostics in step 3 and beyond.
However, by adding this flag, we ensure that '4' supersedes the results of '2' by letting the client know that both are stale results and thus more recent stale results shoudl beat out less recent ones.
In all cases our 'live' diagnostics continue to beat all stale diagnostic sources.