Skip to content
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

Switch liveshare to use LSP pull diagnostics and cleanup server name usages #57596

Merged
merged 7 commits into from
Jan 28, 2022

Conversation

dibarbet
Copy link
Member

@dibarbet dibarbet commented Nov 5, 2021

This switches liveshare pre-emptively over to LSP pull (from LSP push) and removes the razor feature flag for LSP push.

This should fix a couple scenarios where liveshare diagnostics were incorrectly placed, as well as allowing us to completely remove our LSP push diagnostics implementation.

Also consolidated some of the usages of server name into an enum to be clearer and allow handlers to switch off server kind.

TODO - verify live share client side works as expected.
Verified in 17.0p5, there is currently a liveshare bug breaking everything in int.preview - https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1429983
Verified in 17.1p4

private void DiagnosticService_DiagnosticsUpdated(object? _, DiagnosticsUpdatedArgs e)
=> DiagnosticService_DiagnosticsUpdated(e.Solution, e.DocumentId);

private void DiagnosticService_DiagnosticsUpdated(Solution? solution, DocumentId? documentId)
Copy link
Member Author

Choose a reason for hiding this comment

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

🎉

@dibarbet dibarbet marked this pull request as ready for review November 5, 2021 18:53
@dibarbet dibarbet requested a review from a team as a code owner November 5, 2021 18:53
@dibarbet dibarbet added LSP issues related to the roslyn language server protocol implementation and removed Needs UX Triage labels Nov 5, 2021
@ryzngard ryzngard added the UX Review Not Required UX Review Not Required label Nov 5, 2021
@@ -396,15 +396,15 @@ static LSP.Location ConvertTextSpanWithTextToLocation(TextSpan span, SourceText
private static RequestDispatcher CreateRequestDispatcher(TestWorkspace workspace)
{
var factory = workspace.ExportProvider.GetExportedValue<RequestDispatcherFactory>();
return factory.CreateRequestDispatcher(ProtocolConstants.RoslynLspLanguages);
return factory.CreateRequestDispatcher(ProtocolConstants.RoslynLspLanguages, WellKnownLspServerKinds.AlwaysActiveLspServer);
Copy link
Member

Choose a reason for hiding this comment

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

i'm a bit nervous about all tests just getting this particular server. should tests indicate which servers to run against so we can test them all?

Copy link
Member Author

Choose a reason for hiding this comment

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

So 99% of the time this is just used for telemetry purposes. The functionality of all the servers is essentially the same and are instead gated based on the capabilities they provide. They really shouldn't differ in functionality, it is only the special case of diagnostics that we need to know the server.

I've added tests to verify the server based behavior for diagnostics, but otherwise left the default value to be this.

/// XAML LSP servers.
/// </summary>
XamlLspServer,
XamlLspServerDisableUX,
Copy link
Member

Choose a reason for hiding this comment

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

=-o

we have a xaml lsp server?

Copy link
Member Author

Choose a reason for hiding this comment

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

We do in fact, I believe they access solution snapshots and so take advantage of our queueing mechanisms.

Copy link
Contributor

Choose a reason for hiding this comment

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

@CyrusNajmabadi Yes, it's used for LiveShare and it's still internally experimental for the regular client.

/// Diagnostic mode setting for Live Share. This should always be <see cref="DiagnosticMode.Pull"/> as there is no push support in Live Share.
/// This option is only for passing to the diagnostics service and can be removed when we switch all of Roslyn to LSP pull.
/// </summary>
private static readonly Option2<DiagnosticMode> s_liveShareDiagnosticMode = new(nameof(InternalDiagnosticsOptions), "LiveShareDiagnosticMode", defaultValue: DiagnosticMode.Pull);
Copy link
Member

Choose a reason for hiding this comment

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

thanks!

@dibarbet dibarbet merged commit 0761a36 into dotnet:main Jan 28, 2022
@ghost ghost added this to the Next milestone Jan 28, 2022
@dibarbet dibarbet deleted the liveshare_pull_diags branch January 28, 2022 00:43
@RikkiGibson RikkiGibson modified the milestones: Next, 17.2.P1 Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE LSP issues related to the roslyn language server protocol implementation UX Review Not Required UX Review Not Required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants