Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Directive [SPACE] Commit Character #2043

Merged
2 commits merged into from
Jun 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ internal bool TryConvert(RazorCompletionItem razorCompletionItem, out Completion
SortText = razorCompletionItem.DisplayText,
Documentation = descriptionInfo.Description,
Kind = CompletionItemKind.Struct,
CommitCharacters = new Container<string>(razorCompletionItem.CommitCharacters),
};

if (razorCompletionItem == DirectiveAttributeTransitionCompletionItemProvider.TransitionCompletionItem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace Microsoft.CodeAnalysis.Razor.Completion
[Export(typeof(RazorCompletionItemProvider))]
internal class DirectiveCompletionItemProvider : RazorCompletionItemProvider
{
private static readonly IReadOnlyCollection<string> DirectiveCommitCharacters = new string[] { " " };

private static readonly IEnumerable<DirectiveDescriptor> DefaultDirectives = new[]
{
CSharpCodeParser.AddTagHelperDirectiveDescriptor,
Expand Down Expand Up @@ -108,7 +110,8 @@ internal static List<RazorCompletionItem> GetDirectiveCompletionItems(RazorSynta
var completionItem = new RazorCompletionItem(
completionDisplayText,
directive.Directive,
RazorCompletionItemKind.Directive);
RazorCompletionItemKind.Directive,
DirectiveCommitCharacters);
var completionDescription = new DirectiveCompletionDescription(directive.Description);
completionItem.SetDirectiveCompletionDescription(completionDescription);
completionItems.Add(completionItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using Microsoft.AspNetCore.Razor.Language.Extensions;
using Microsoft.AspNetCore.Razor.Language.Legacy;
using Microsoft.AspNetCore.Razor.Language.Syntax;
using Moq;
using Xunit;

namespace Microsoft.CodeAnalysis.Razor.Completion
Expand Down Expand Up @@ -289,6 +288,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) =>
Expand Down