Browse Source

Fixed failing unit test.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
a33b320958
  1. 8
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
  2. 30
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

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

@ -870,6 +870,8 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -870,6 +870,8 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
if (this.currentMember != null) {
var def = ctx.CurrentTypeDefinition ?? Compilation.MainAssembly.GetTypeDefinition (currentType);
foreach (var member in def.GetMembers ()) {
if (member is IMethod && ((IMethod)member).FullName == "System.Object.Finalize")
continue;
if (memberPred == null || memberPred (member))
wrapper.AddMember (member);
}
@ -1854,6 +1856,12 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -1854,6 +1856,12 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
baseUnit = ParseStub ("a;", false);
type = baseUnit.GetNodeAt<MemberType> (location);
}
if (type == null) {
baseUnit = ParseStub ("A a;", false);
type = baseUnit.GetNodeAt<MemberType> (location);
}
if (type != null) {
// insert target type into compilation unit, to respect the
var target = type.Target;

30
ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

@ -1691,6 +1691,36 @@ class A @@ -1691,6 +1691,36 @@ class A
});
}
/// <summary>
/// Bug 2799 - No completion offered when declaring fields in a class
/// </summary>
[Test()]
public void TestBug2799 ()
{
CombinedProviderTest (
@"namespace Foobar
{
class MainClass
{
public enum Foo
{
Value1,
Value2
}
}
public class Second
{
$MainClass.$
}
}
", provider => {
Assert.IsNotNull (provider.Find ("Foo"), "'Foo' not found.");
});
}
[Test()]

Loading…
Cancel
Save