From abc35d6d16eb3c0c0aafd67734f01217047a3c90 Mon Sep 17 00:00:00 2001 From: Todd Grunke Date: Tue, 30 Apr 2024 16:12:19 -0700 Subject: [PATCH] Fix failures in C# LSP inline completion (snippets) (#73282) These failures were happening due to serialization failing on the types being passed over the wire due to missing DataContract attributes. I did a pass through all VSInternal types defined in CLaSP and made sure that we matched which ones had the DataContract attribute to match what the VSLanguageServerClient repo does. --- .../Protocol/Protocol/Internal/VSInternalHover.cs | 1 + .../Protocol/Internal/VSInternalInlineCompletionContext.cs | 1 + .../Protocol/Internal/VSInternalInlineCompletionItem.cs | 3 ++- .../Protocol/Internal/VSInternalInlineCompletionList.cs | 3 ++- .../Protocol/Internal/VSInternalInlineCompletionRequest.cs | 1 + .../Protocol/Protocol/Internal/VSInternalReferenceParams.cs | 1 + .../Protocol/Internal/VSInternalSelectedCompletionInfo.cs | 3 ++- .../Internal/VSInternalTextDocumentClientCapabilities.cs | 1 + 8 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalHover.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalHover.cs index ea9a5ec9094f6..de87ad88193bc 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalHover.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalHover.cs @@ -10,6 +10,7 @@ namespace Roslyn.LanguageServer.Protocol /// /// Extension to Hover which adds additional data for colorization. /// + [DataContract] internal class VSInternalHover : Hover { /// diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionContext.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionContext.cs index 284ffa5d505ae..a3ab7943d4821 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionContext.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionContext.cs @@ -12,6 +12,7 @@ namespace Roslyn.LanguageServer.Protocol /// Context for inline completion request. /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L27. /// + [DataContract] internal class VSInternalInlineCompletionContext { /// diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionItem.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionItem.cs index 73fb5c5285852..740c6799c26d9 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionItem.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionItem.cs @@ -13,6 +13,7 @@ namespace Roslyn.LanguageServer.Protocol /// /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L78. /// + [DataContract] internal class VSInternalInlineCompletionItem { /// @@ -45,4 +46,4 @@ internal class VSInternalInlineCompletionItem [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public InsertTextFormat? TextFormat { get; set; } = InsertTextFormat.Plaintext; } -} \ No newline at end of file +} diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionList.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionList.cs index 62f4b20ba0d07..57c7957df661b 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionList.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionList.cs @@ -12,6 +12,7 @@ namespace Roslyn.LanguageServer.Protocol /// /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L72. /// + [DataContract] internal class VSInternalInlineCompletionList { /// @@ -21,4 +22,4 @@ internal class VSInternalInlineCompletionList [JsonProperty(Required = Required.Always)] public VSInternalInlineCompletionItem[] Items { get; set; } } -} \ No newline at end of file +} diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionRequest.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionRequest.cs index fe3840400b762..a57c4f294d4db 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionRequest.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalInlineCompletionRequest.cs @@ -12,6 +12,7 @@ namespace Roslyn.LanguageServer.Protocol /// /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L24. /// + [DataContract] internal class VSInternalInlineCompletionRequest : ITextDocumentParams { /// diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceParams.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceParams.cs index a302b2baeb3ce..ef0a031bbb6dd 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceParams.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalReferenceParams.cs @@ -10,6 +10,7 @@ namespace Roslyn.LanguageServer.Protocol /// /// Class which represents extensions of passed as parameter of find reference requests. /// + [DataContract] internal class VSInternalReferenceParams : ReferenceParams { /// diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSelectedCompletionInfo.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSelectedCompletionInfo.cs index 566acebde174c..963cc264e0acf 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSelectedCompletionInfo.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalSelectedCompletionInfo.cs @@ -12,6 +12,7 @@ namespace Roslyn.LanguageServer.Protocol /// /// See https://github.com/microsoft/vscode/blob/075ba020e8493f40dba89891b1a08453f2c067e9/src/vscode-dts/vscode.proposed.inlineCompletions.d.ts#L48. /// + [DataContract] internal class VSInternalSelectedCompletionInfo { /// @@ -42,4 +43,4 @@ internal class VSInternalSelectedCompletionInfo [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool IsSnippetText { get; set; } } -} \ No newline at end of file +} diff --git a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs index 1ae592269a85e..abc8b2b3749ed 100644 --- a/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs +++ b/src/Features/LanguageServer/Protocol/Protocol/Internal/VSInternalTextDocumentClientCapabilities.cs @@ -10,6 +10,7 @@ namespace Roslyn.LanguageServer.Protocol /// /// Text document capabilities specific to Visual Studio. /// + [DataContract] internal class VSInternalTextDocumentClientCapabilities : TextDocumentClientCapabilities { ///