diff options
3 files changed, 45 insertions, 47 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterHintingEngine.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterHintingEngine.cs index 97e3542c65..dd9512f007 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterHintingEngine.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterHintingEngine.cs @@ -269,9 +269,13 @@ namespace ICSharpCode.NRefactory6.CSharp.Completion var info = semanticModel.GetSymbolInfo(node, cancellationToken); var result = new ParameterHintingResult(node.SpanStart); var resolvedMethod = info.Symbol as IMethodSymbol; - if (resolvedMethod != null) - result.AddData(factory.CreateConstructorProvider(resolvedMethod)); - result.AddRange(info.CandidateSymbols.OfType<IMethodSymbol>().Select (m => factory.CreateConstructorProvider(m))); + if (resolvedMethod != null) { + foreach (var c in resolvedMethod.ContainingType.GetMembers ().OfType<IMethodSymbol> ().Where (m => m.MethodKind == MethodKind.Constructor)) { + result.AddData (factory.CreateConstructorProvider (c)); + } + } else { + result.AddRange (info.CandidateSymbols.OfType<IMethodSymbol> ().Select (m => factory.CreateConstructorProvider (m))); + } return result; } diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs index 4cc0a70770..180095af9a 100644 --- a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs +++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/CodeCompletion/NR6/MiscTests.cs @@ -27,6 +27,7 @@ using System; using NUnit.Framework; using ICSharpCode.NRefactory6.CSharp.Completion; using ICSharpCode.NRefactory6.CSharp.CodeCompletion.Roslyn; +using System.Reflection.Metadata.Ecma335.Blobs; namespace ICSharpCode.NRefactory6.CSharp.CodeCompletion.NR6 { @@ -210,40 +211,5 @@ class Test Assert.AreEqual (2, data.OverloadedData.Count); } - - /// <summary> - /// Bug 41388 - Code completion is incorrect for array types - /// </summary> - [Test] - public void TestBug41388 () - { - var provider = CreateProvider ( - @" -using System; - -class Test -{ - public event EventHandler FooBar; - - public Test[] test { get; private set; } - - - public Test() - { - test = new $$ - FooBar += Test_FooBar; - } - - void Test_FooBar(object sender, EventArgs e) - { - - } -} - -"); - Assert.IsNotNull (provider, "provider was not created."); - - Assert.IsNull (provider.Find ("System.Action<object, System.EventArgs>")); - } } } diff --git a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/ParameterHinting/ParameterHintingTests.cs b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/ParameterHinting/ParameterHintingTests.cs index bedaa31fb7..8d6579fff4 100644 --- a/main/tests/MonoDevelop.CSharpBinding.Tests/Features/ParameterHinting/ParameterHintingTests.cs +++ b/main/tests/MonoDevelop.CSharpBinding.Tests/Features/ParameterHinting/ParameterHintingTests.cs @@ -1364,28 +1364,56 @@ namespace Test40018 } /// <summary> - /// Bug 41351 - No arguments code completion for methods called via ?. operator + /// Bug 41245 - Attribute code completion not showing all constructors and showing too many things /// </summary> [Test] - public void TestBug41351 () + public void TestBug41245 () { var provider = CreateProvider ( @" using System; -class test +namespace cp654fz7 { - public event EventHandler Handler; + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false)] + public sealed class JsonPropertyAttribute : Attribute + { + internal bool? _isReference; + internal int? _order; + public bool IsReference + { + get { return _isReference ?? default(bool); } + set { _isReference = value; } + } + public int Order + { + get { return _order ?? default(int); } + set { _order = value; } + } + public string PropertyName { get; set; } + public JsonPropertyAttribute() + { + } + + public JsonPropertyAttribute(string propertyName) + { + PropertyName = propertyName; + } + } - public test() + class MainClass { - Handler?.Invoke($$); + [JsonProperty($$)] + public object MyProperty { get; set; } + + public static void Main(string[] args) + { + } } } - "); Assert.IsNotNull (provider, "provider was not created."); - Assert.AreEqual (1, provider.Count); + Assert.AreEqual (2, provider.Count); } } -} +}
\ No newline at end of file |