Browse Source

[CodeCompletion] Fixed ctrl+space behavior (it's now more intrusive -

but it should be it, the user requests it).
newNRvisualizers
Mike Krüger 13 years ago
parent
commit
b8fce0c557
  1. 21
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs

21
ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs

@ -671,18 +671,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -671,18 +671,7 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
return controlSpace ? HandleAccessorContext() ?? DefaultControlSpaceItems(identifierStart) : null;
}
char prevCh = offset > 2 ? document.GetCharAt(offset - 2) : ';';
char nextCh = offset < document.TextLength ? document.GetCharAt(offset) : ' ';
const string allowedChars = ";,.[](){}+-*/%^?:&|~!<>=";
if (!Char.IsWhiteSpace(nextCh) && allowedChars.IndexOf(nextCh) < 0) {
return null;
}
if (!(Char.IsWhiteSpace(prevCh) || allowedChars.IndexOf(prevCh) >= 0)) {
if (controlSpace && identifierStart != null && identifierStart.Node is IdentifierExpression)
return DefaultControlSpaceItems(identifierStart);
return null;
}
// Do not pop up completion on identifier identifier (should be handled by keyword completion).
tokenIndex = offset - 1;
token = GetPreviousToken(ref tokenIndex, false);
@ -695,6 +684,16 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -695,6 +684,16 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
return keywordresult;
}
char prevCh = offset > 2 ? document.GetCharAt(offset - 2) : ';';
char nextCh = offset < document.TextLength ? document.GetCharAt(offset) : ' ';
const string allowedChars = ";,.[](){}+-*/%^?:&|~!<>=";
if ((!Char.IsWhiteSpace(nextCh) && allowedChars.IndexOf(nextCh) < 0) || !(Char.IsWhiteSpace(prevCh) || allowedChars.IndexOf(prevCh) >= 0)) {
if (controlSpace)
return DefaultControlSpaceItems(identifierStart);
return null;
}
int prevTokenIndex = tokenIndex;
var prevToken2 = GetPreviousToken(ref prevTokenIndex, false);
if (prevToken2 == "delegate") {

Loading…
Cancel
Save