Skip to content

Commit

Permalink
Added Colon as a Commit Character
Browse files Browse the repository at this point in the history
  • Loading branch information
TanayParikh committed Apr 29, 2020
1 parent 646983a commit bc89c59
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ internal bool TryConvert(RazorCompletionItem razorCompletionItem, out Completion
FilterText = razorCompletionItem.InsertText,
SortText = razorCompletionItem.InsertText,
Kind = CompletionItemKind.TypeParameter,
CommitCharacters = new Container<string>(razorCompletionItem.CommitCharacters),
};

var indexerCompletion = razorCompletionItem.DisplayText.EndsWith("...");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ namespace Microsoft.CodeAnalysis.Razor.Completion
[Export(typeof(RazorCompletionItemProvider))]
internal class DirectiveAttributeCompletionItemProvider : DirectiveAttributeCompletionItemProviderBase
{
private static readonly IReadOnlyCollection<string> ElementCommitCharacters = new HashSet<string> { ":" };

private readonly TagHelperFactsService _tagHelperFactsService;

[ImportingConstructor]
Expand Down Expand Up @@ -153,7 +155,8 @@ internal IReadOnlyList<RazorCompletionItem> GetAttributeCompletions(
var razorCompletionItem = new RazorCompletionItem(
completion.Key,
insertText,
RazorCompletionItemKind.DirectiveAttribute);
RazorCompletionItemKind.DirectiveAttribute,
ElementCommitCharacters);
var completionDescription = new AttributeCompletionDescription(completion.Value.ToArray());
razorCompletionItem.SetAttributeCompletionDescription(completionDescription);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Razor.Completion
{
internal class MarkupTransitionCompletionItemProvider : RazorCompletionItemProvider
{
private static readonly IReadOnlyCollection<string> ElementCommitCharacters = new HashSet<string>{">"};
private static readonly IReadOnlyCollection<string> ElementCommitCharacters = new HashSet<string>{ ">" };

private readonly HtmlFactsService _htmlFactsService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal class InitializeHandler : IRequestHandler<InitializeParams, InitializeR
{
CompletionProvider = new CompletionOptions()
{
AllCommitCharacters = new[] { " ", ".", ";", ">", "=" }, // This is necessary to workaround a bug where the commit character in CompletionItem is not respected.
AllCommitCharacters = new[] { " ", ".", ";", ">", "=", ":" }, // This is necessary to workaround a bug where the commit character in CompletionItem is not respected.
ResolveProvider = true,
TriggerCharacters = new[] { ".", "@", "<", "&", "\\", "/", "'", "\"", "=", ":", " ", "(" }
},
Expand Down

0 comments on commit bc89c59

Please sign in to comment.