Skip to content

Commit

Permalink
Trigger on ': '
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamescaper committed Jan 3, 2019
1 parent 3e31ace commit 84723e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class LocalsCompletionProvider : ISimpleCompletionProvider, ITriggerCompl
private static readonly Regex AttributeArgumentRegex = new Regex(@"\[\w+\((|[^\]]+, )$");

private static readonly string[] SymbolsToTriggerCompletion
= new[] { ", ", "return ", "== ", "!= ", "> ", "< ", "<= ", ">= " };
= new[] { ", ", "return ", "== ", "!= ", "> ", "< ", "<= ", ">= ", ": " };

public IEnumerable<CompletionItem> GetCompletionItems(SyntaxContext syntaxContext, Options.Options options)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public bool ShouldTriggerCompletion(SourceText text, int caretPosition, Completi
var textBeforeCaret = currentLine.ToString().Substring(0, caretPosition - currentLine.Start);
if (trigger.Kind == CompletionTriggerKind.Insertion
&& (textBeforeCaret.EndsWith(" = ")
|| textBeforeCaret.EndsWith(": ")
|| textBeforeCaret.EndsWith(" = new ")
|| textBeforeCaret.EndsWith("return ")
|| BracketRegex.IsMatch(textBeforeCaret))
Expand Down

0 comments on commit 84723e0

Please sign in to comment.