提交 52b124a9 编写于 作者: J Jason Malinowski

Now that we are using JsonConverters we can use that for VSClientCapabilities too

上级 26cc5f60
......@@ -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<TextDocumentIdentifier, VSTextDocumentIdentifier>());
jsonMessageFormatter.JsonSerializer.Converters.Add(new VSExtensionConverter<ClientCapabilities, VSClientCapabilities>());
_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.
/// </summary>
[JsonRpcMethod(Methods.InitializeName)]
public async Task<InitializeResult> InitializeAsync(JToken input, CancellationToken cancellationToken)
[JsonRpcMethod(Methods.InitializeName, UseSingleObjectParameterDeserialization = true)]
public async Task<InitializeResult> 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<VSClientCapabilities>();
_clientCapabilities = (VSClientCapabilities)initializeParams.Capabilities;
var serverCapabilities = await _protocol.ExecuteRequestAsync<InitializeParams, InitializeResult>(Methods.InitializeName,
_workspace.CurrentSolution, input.ToObject<InitializeParams>(), _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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册