diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs index b9a93d47a8..f3457d140a 100644 --- a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs +++ b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs @@ -67,7 +67,6 @@ namespace ICSharpCode.VBNetBinding if (insightWindow != null) { insightHandler.InitializeOpenedInsightWindow(editor, insightWindow); insightHandler.HighlightParameter(insightWindow, 0); - insightWindow.CaretPositionChanged += delegate { Run(insightWindow, editor); }; } return CodeCompletionKeyPressResult.Completed; } @@ -75,14 +74,8 @@ namespace ICSharpCode.VBNetBinding case ',': if (CodeCompletionOptions.InsightRefreshOnComma && CodeCompletionOptions.InsightEnabled) { IInsightWindow insightWindow; - editor.Document.Insert(editor.Caret.Offset, ","); - if (insightHandler.InsightRefreshOnComma(editor, ch, out insightWindow)) { - if (insightWindow != null) { - insightHandler.HighlightParameter(insightWindow, GetArgumentIndex(editor) + 1); - insightWindow.CaretPositionChanged += delegate { Run(insightWindow, editor); };; - } - } - return CodeCompletionKeyPressResult.EatKey; + if (insightHandler.InsightRefreshOnComma(editor, ch, out insightWindow)) + return CodeCompletionKeyPressResult.Completed; } break; case '\n': @@ -145,26 +138,6 @@ namespace ICSharpCode.VBNetBinding return CodeCompletionKeyPressResult.None; } - void Run(IInsightWindow insightWindow, ITextEditor editor) - { - insightHandler.HighlightParameter(insightWindow, GetArgumentIndex(editor)); - } - - static int GetArgumentIndex(ITextEditor editor) - { - ILexer lexer = ParserFactory.CreateLexer(SupportedLanguage.VBNet, editor.Document.CreateReader()); - ExpressionFinder ef = new ExpressionFinder(); - - Token t = lexer.NextToken(); - - while (t.Kind != Tokens.EOF && t.Location < editor.Caret.Position) { - ef.InformToken(t); - t = lexer.NextToken(); - } - - return ef.ActiveArgument; - } - static bool IsTypeCharacter(char ch, char prevChar) { ch = char.ToUpperInvariant(ch);