-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Conversation
private void DiagnosticService_DiagnosticsUpdated(object? _, DiagnosticsUpdatedArgs e) | ||
=> DiagnosticService_DiagnosticsUpdated(e.Solution, e.DocumentId); | ||
|
||
private void DiagnosticService_DiagnosticsUpdated(Solution? solution, DocumentId? documentId) |
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.
🎉
src/EditorFeatures/Core/Implementation/LanguageServer/VisualStudioInProcLanguageServer.cs
Show resolved
Hide resolved
@@ -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); |
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.
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?
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.
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.
src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs
Outdated
Show resolved
Hide resolved
src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs
Outdated
Show resolved
Hide resolved
/// XAML LSP servers. | ||
/// </summary> | ||
XamlLspServer, | ||
XamlLspServerDisableUX, |
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.
=-o
we have a xaml lsp server?
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.
We do in fact, I believe they access solution snapshots and so take advantage of our queueing mechanisms.
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.
@CyrusNajmabadi Yes, it's used for LiveShare and it's still internally experimental for the regular client.
src/Features/LanguageServer/Protocol/WellKnownLspServerKinds.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Diagnostics/InternalDiagnosticsOptions.cs
Outdated
Show resolved
Hide resolved
/// 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); |
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.
thanks!
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/1429983Verified in 17.1p4