From f98d78d9da1200cf272726c0843d1f3afbdfb996 Mon Sep 17 00:00:00 2001 From: Tanay Parikh Date: Tue, 16 Jun 2020 15:51:05 -0700 Subject: [PATCH] Added Directive [SPACE] Commit Character Fixes: https://github.com/dotnet/aspnetcore/issues/22886 --- .../Completion/RazorCompletionEndpoint.cs | 1 + .../Completion/DirectiveCompletionItemProvider.cs | 3 ++- .../Completion/DirectiveCompletionItemProviderTest.cs | 1 + 3 files changed, 4 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..00d08fbbaa4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionEndpoint.cs @@ -248,6 +248,7 @@ internal bool TryConvert(RazorCompletionItem razorCompletionItem, out Completion SortText = razorCompletionItem.DisplayText, Documentation = descriptionInfo.Description, Kind = CompletionItemKind.Struct, + CommitCharacters = new Container(razorCompletionItem.CommitCharacters), }; if (razorCompletionItem == DirectiveAttributeTransitionCompletionItemProvider.TransitionCompletionItem) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/DirectiveCompletionItemProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/DirectiveCompletionItemProvider.cs index 6091d7ac7d8..d3c9b3ac533 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/DirectiveCompletionItemProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/DirectiveCompletionItemProvider.cs @@ -108,7 +108,8 @@ internal static List GetDirectiveCompletionItems(RazorSynta var completionItem = new RazorCompletionItem( completionDisplayText, directive.Directive, - RazorCompletionItemKind.Directive); + RazorCompletionItemKind.Directive, + new string[] { " " }); var completionDescription = new DirectiveCompletionDescription(directive.Description); completionItem.SetDirectiveCompletionDescription(completionDescription); completionItems.Add(completionItem); diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Completion/DirectiveCompletionItemProviderTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Completion/DirectiveCompletionItemProviderTest.cs index d8e9c4013e8..80c6ff63c09 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Completion/DirectiveCompletionItemProviderTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Completion/DirectiveCompletionItemProviderTest.cs @@ -289,6 +289,7 @@ private static void AssertRazorCompletionItem(string completionDisplayText, Dire Assert.Equal(item.InsertText, directive.Directive); var completionDescription = item.GetDirectiveCompletionDescription(); Assert.Equal(directive.Description, completionDescription.Description); + Assert.Single(item.CommitCharacters, " "); } private static void AssertRazorCompletionItem(DirectiveDescriptor directive, RazorCompletionItem item) =>