Browse Source

Fixed constraint completion bug.

pull/32/merge
Mike Krüger 13 years ago
parent
commit
92a62059de
  1. 4
      ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs
  2. 22
      ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs

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

@ -1547,6 +1547,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion @@ -1547,6 +1547,10 @@ namespace ICSharpCode.NRefactory.CSharp.Completion
wrapper.AddNamespace(lookup, curNs);
}
}
if (node is AstType && node.Parent is Constraint) {
wrapper.AddCustom ("new()");
}
}
IEnumerable<ICompletionData> HandleKeywordCompletion(int wordStart, string word)

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

@ -5925,5 +5925,27 @@ public class Testing @@ -5925,5 +5925,27 @@ public class Testing
Assert.IsTrue(provider == null || provider.Count == 0);
});
}
/// <summary>
///Bug 9905 - Cannot type new() constraint
/// </summary>
[Test]
public void TestBug9905 ()
{
CombinedProviderTest(
@"using System;
public class Testing
{
public static void DoNothing<T>() where T : class$, n$
{
}
}
", provider => {
Assert.IsNotNull(provider.Find("new()"));
});
}
}
}

Loading…
Cancel
Save