Browse Source

Fixed other LINQ case.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
12b9542414
  1. 2
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
  2. 19
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionCSharp3Tests.cs

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

@ -408,6 +408,8 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -408,6 +408,8 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
if (IsInsideCommentOrString ())
return null;
if (IsInLinqContext (offset)) {
if (!controlSpace && !(char.IsLetter (completionChar) || completionChar == '_'))
return null;
tokenIndex = offset;
token = GetPreviousToken (ref tokenIndex, false); // token last typed
if (!char.IsWhiteSpace (completionChar) && !linqKeywords.Contains (token))

19
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionCSharp3Tests.cs

@ -447,6 +447,25 @@ class A @@ -447,6 +447,25 @@ class A
}
}
");
Assert.IsTrue(provider == null || provider.Count == 0); // <--- here 0 item in the completion list
}
[Test()]
public void TestLinqExpressionContext ()
{
var provider = CodeCompletionBugTests.CreateProvider(
@"
using System.Collections.Generic;
using System.Linq;
class A
{
public static void Main (string[] args)
{
$from a in args where a !$
}
}
");
Assert.IsTrue(provider == null || provider.Count == 0); // <--- here 0 item in the completion list
}

Loading…
Cancel
Save