From 771443018462676d70d770b75e428913f7aad38e Mon Sep 17 00:00:00 2001 From: Tanay Parikh Date: Fri, 29 May 2020 10:31:38 -0700 Subject: [PATCH 1/2] Updates for Multiple Language Server CompletionOptions Support Currently blocked on the VS LSP fix. Fixes: https://github.com/dotnet/aspnetcore/issues/21346 --- .../Completion/RazorCompletionEndpoint.cs | 4 ++++ .../HtmlCSharp/InitializeHandler.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs index 2d87f72a237..0908ea3e8bc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs @@ -165,6 +165,10 @@ public CompletionRegistrationOptions GetRegistrationOptions() DocumentSelector = RazorDefaults.Selector, ResolveProvider = true, TriggerCharacters = new Container("@", "<", ":"), + + // NOTE: This property is *NOT* processed in O# versions < 0.16 + // https://github.com/OmniSharp/csharp-language-server-protocol/blame/bdec4c73240be52fbb25a81f6ad7d409f77b5215/src/Protocol/Server/Capabilities/CompletionOptions.cs#L35-L44 + AllCommitCharacters = new Container(":", ">", " ", "=" ), }; } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs index 2c70c608cb0..994d745f1c8 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs @@ -18,7 +18,7 @@ internal class InitializeHandler : IRequestHandler", "=", ":", "(", ")" }, // This is necessary to workaround a bug where the commit character in CompletionItem is not respected. + AllCommitCharacters = new[] { " ", ".", ";", ">", "=", "(", ")" }, ResolveProvider = true, TriggerCharacters = new[] { ".", "@", "<", "&", "\\", "/", "'", "\"", "=", ":", " " } }, From fe1ac0ea9303cb8e82bb0d8567e2600a92a5c215 Mon Sep 17 00:00:00 2001 From: Tanay Parikh Date: Mon, 13 Jul 2020 17:29:41 -0700 Subject: [PATCH 2/2] Fix Merge Conflict --- .../Completion/RazorCompletionEndpoint.cs | 2 +- .../HtmlCSharp/InitializeHandler.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs index 0908ea3e8bc..01398440f59 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs @@ -168,7 +168,7 @@ public CompletionRegistrationOptions GetRegistrationOptions() // NOTE: This property is *NOT* processed in O# versions < 0.16 // https://github.com/OmniSharp/csharp-language-server-protocol/blame/bdec4c73240be52fbb25a81f6ad7d409f77b5215/src/Protocol/Server/Capabilities/CompletionOptions.cs#L35-L44 - AllCommitCharacters = new Container(":", ">", " ", "=" ), + AllCommitCharacters = new Container(":", ">", " ", "=" ), }; } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs index 994d745f1c8..c0e1f67a76b 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/HtmlCSharp/InitializeHandler.cs @@ -18,7 +18,7 @@ internal class InitializeHandler : IRequestHandler", "=", "(", ")" }, + AllCommitCharacters = new[] { " ", ".", ";", ">", "=", "(", ")", "[", "]", "{", "}", "!" }, ResolveProvider = true, TriggerCharacters = new[] { ".", "@", "<", "&", "\\", "/", "'", "\"", "=", ":", " " } },