diff --git a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs index 22219ff31d..2470702c3e 100644 --- a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs +++ b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs @@ -1529,11 +1529,12 @@ namespace ICSharpCode.NRefactory.CSharp.Completion return e.Name + "`" + e.TypeParameters.Count; } - void AddVirtuals (Dictionary alreadyInserted, CompletionDataWrapper col, string modifiers, IType curType, int declarationBegin) + void AddVirtuals(Dictionary alreadyInserted, CompletionDataWrapper col, string modifiers, IType curType, int declarationBegin) { - if (curType == null) + if (curType == null) { return; - foreach (var m in curType.GetMethods (m => !m.IsConstructor && !m.IsDestructor).Cast ().Concat (curType.GetProperties ().Cast ()).Reverse ()) { + } + foreach (var m in curType.GetMembers ().Reverse ()) { if (m.IsSynthetic || curType.Kind != TypeKind.Interface && !m.IsOverridable) continue; // filter out the "Finalize" methods, because finalizers should be done with destructors. diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs index 5936c5b87f..9ce8ef795f 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/CodeCompletionBugTests.cs @@ -1672,6 +1672,37 @@ class A Assert.IsNull (provider.Find ("Finalize"), "'Finalize' found."); }); } + [Test()] + public void TestOverrideCompletion () + { + CombinedProviderTest ( +@"using System; + +class Base +{ + + public virtual int Property { get;} + public virtual int Method () { } + public virtual event EventHandler Event; + public virtual int this[int i] { get { } } +} + + +class A : Base +{ + $public override $ +} +", provider => { + Assert.IsNotNull (provider.Find ("Property"), "'Property' not found."); + Assert.IsNotNull (provider.Find ("Method"), "'Method' not found."); + Assert.IsNotNull (provider.Find ("Event"), "'Event' not found."); + Assert.IsNotNull (provider.Find ("ToString"), "'Event' not found."); + Assert.IsNotNull (provider.Find ("GetHashCode"), "'GetHashCode' not found."); + Assert.IsNotNull (provider.Find ("Equals"), "'Equals' not found."); + Assert.AreEqual (7, provider.Count); + }); + } + /// /// Bug 3370 -MD ignores member hiding