Skip to content

Restore LSP push diagnostics.#48888

Merged
2 commits merged intodotnet:masterfrom
CyrusNajmabadi:lspPushDiagnostics
Oct 25, 2020
Merged

Restore LSP push diagnostics.#48888
2 commits merged intodotnet:masterfrom
CyrusNajmabadi:lspPushDiagnostics

Conversation

@CyrusNajmabadi
Copy link
Contributor

No description provided.


private async Task<Dictionary<Uri, ImmutableArray<LSP.Diagnostic>>> GetDiagnosticsAsync(Document document, CancellationToken cancellationToken)
{
var diagnostics = _diagnosticService.GetDiagnostics(document.Project.Solution.Workspace, document.Project.Id, document.Id, id: null, includeSuppressedDiagnostics: false, forPullDiagnostics: false, cancellationToken)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that this says forPushDiagnostics: true. meaning that we will push in our current mode where we have not switched to 'pull diagnostics'. However, if we flip the new option to "use pull diagnostics", this will now cause us to get no diagnostics back here, so we'll push nothing.

Copy link
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to make sure my understanding of the PR is correct
In summary:

  1. LiveshareInProcLanguageClient supports push only which is used in codespaces.
  2. PullDiagnosticsLanguageClient supports pull only when the feature flag is enabled.

So in codespace when feature flag is off:

  1. LiveshareInProcLanguageClient pushes all diagnostics
  2. PullDiagnosticsLanguageClient is not pulled from as the capability for pull = false

And when feature flag is on in a codespace (this is an unlikely scenario as setting roslyn options in a codespaces is not yet working, see #48567 . Therefore I don't much care about what happens here):

  1. The LiveshareLanguageServerClient will not push anything because it is a push client of the diagnostic service.
  2. The platform ignore pushes anyway, and only pull diagnostics from PullDiagnosticsLanguageClient (which returns results as the feature flag is on and it is a pull client for the diagnostics service)

And in a non-codespace

  1. LSP push is never used (has DisableUserExperience(true))
  2. The feature flag switches between local roslyn and LSP pull for diagnostics

@CyrusNajmabadi
Copy link
Contributor Author

LiveshareInProcLanguageClient supports push only which is used in codespaces.

Yes.

PullDiagnosticsLanguageClient supports pull only when the feature flag is enabled.

yes

So in codespace when feature flag is off:

yes

PullDiagnosticsLanguageClient is not pulled from as the capability for pull = false

yes

The LiveshareLanguageServerClient will not push anything because it is a push client of the diagnostic service.

I don't know. Depends on if this option is seen by liveshare.

The platform ignore pushes anyway, and only pull diagnostics from PullDiagnosticsLanguageClient (which returns results as the feature flag is on and it is a pull client for the diagnostics service

that is how it should behave. I'm a little wary about this as this is all very complex. However, if they do push, it's a problem on their end.

And in a non-codespace

LSP push is never used (has DisableUserExperience(true))

Yes.

The feature flag switches between local roslyn and LSP pull for diagnostics

Yes.

@ghost
Copy link

ghost commented Oct 23, 2020

Hello @CyrusNajmabadi!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approval

@ghost ghost merged commit 09bca57 into dotnet:master Oct 25, 2020
@ghost ghost added this to the Next milestone Oct 25, 2020
@CyrusNajmabadi CyrusNajmabadi deleted the lspPushDiagnostics branch October 25, 2020 03:16
@allisonchou allisonchou modified the milestones: Next, 16.9.P2 Nov 24, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants