From 84723e08befbdd776fefc09d968bf473583f69df Mon Sep 17 00:00:00 2001 From: Oleksandr Liakhevych Date: Thu, 3 Jan 2019 14:20:00 +0200 Subject: [PATCH] Trigger on ': ' --- .../IntelliSense/Providers/LocalsCompletionProvider.cs | 2 +- .../IntelliSense/Providers/NewObjectCompletionProvider.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/IntelliSenseExtender/IntelliSense/Providers/LocalsCompletionProvider.cs b/IntelliSenseExtender/IntelliSense/Providers/LocalsCompletionProvider.cs index 5c55e6b..e8aea09 100644 --- a/IntelliSenseExtender/IntelliSense/Providers/LocalsCompletionProvider.cs +++ b/IntelliSenseExtender/IntelliSense/Providers/LocalsCompletionProvider.cs @@ -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 GetCompletionItems(SyntaxContext syntaxContext, Options.Options options) { diff --git a/IntelliSenseExtender/IntelliSense/Providers/NewObjectCompletionProvider.cs b/IntelliSenseExtender/IntelliSense/Providers/NewObjectCompletionProvider.cs index 02b3b40..cc15b0b 100644 --- a/IntelliSenseExtender/IntelliSense/Providers/NewObjectCompletionProvider.cs +++ b/IntelliSenseExtender/IntelliSense/Providers/NewObjectCompletionProvider.cs @@ -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))