Browse Source

fix parameter highlighting for VB

4.1
Siegfried Pammer 14 years ago
parent
commit
e0a38744bb
  1. 31
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs

31
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs

@ -67,7 +67,6 @@ namespace ICSharpCode.VBNetBinding @@ -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 @@ -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 @@ -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);

Loading…
Cancel
Save