diff --git a/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs b/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs index 3df0692c14167e58559cd8131bd48b37d61efaca..8938098d4974afc7ab306e99510ea1581aa586ae 100644 --- a/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs +++ b/src/VisualStudio/Core/Def/Implementation/LanguageClient/InProcLanguageServer.cs @@ -21,7 +21,6 @@ using Microsoft.VisualStudio.LanguageServer.Client; using Microsoft.VisualStudio.LanguageServer.Protocol; using Microsoft.VisualStudio.Utilities.Internal; -using Newtonsoft.Json.Linq; using Roslyn.Utilities; using StreamJsonRpc; using LSP = Microsoft.VisualStudio.LanguageServer.Protocol; @@ -50,6 +49,7 @@ internal class InProcLanguageServer var jsonMessageFormatter = new JsonMessageFormatter(); jsonMessageFormatter.JsonSerializer.Converters.Add(new VSExtensionConverter()); + jsonMessageFormatter.JsonSerializer.Converters.Add(new VSExtensionConverter()); _jsonRpc = new JsonRpc(new HeaderDelimitedMessageHandler(outputStream, inputStream, jsonMessageFormatter)); _jsonRpc.AddLocalRpcTarget(this); @@ -67,15 +67,14 @@ internal class InProcLanguageServer /// and responding with the server capabilities. /// The specification assures that the initialize request is sent only once. /// - [JsonRpcMethod(Methods.InitializeName)] - public async Task InitializeAsync(JToken input, CancellationToken cancellationToken) + [JsonRpcMethod(Methods.InitializeName, UseSingleObjectParameterDeserialization = true)] + public async Task InitializeAsync(InitializeParams initializeParams, CancellationToken cancellationToken) { - // InitializeParams only references ClientCapabilities, but the VS LSP client - // sends additional VS specific capabilities, so directly deserialize them into the VSClientCapabilities - // to avoid losing them. - _clientCapabilities = input["capabilities"].ToObject(); + _clientCapabilities = (VSClientCapabilities)initializeParams.Capabilities; + var serverCapabilities = await _protocol.ExecuteRequestAsync(Methods.InitializeName, - _workspace.CurrentSolution, input.ToObject(), _clientCapabilities, _clientName, cancellationToken).ConfigureAwait(false); + _workspace.CurrentSolution, initializeParams, _clientCapabilities, _clientName, cancellationToken).ConfigureAwait(false); + // Always support hover - if any LSP client for a content type advertises support, // then the liveshare provider is disabled. So we must provide for both C# and razor // until https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1106064/ is fixed