diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2015-09-16 11:56:07 +0300 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2015-09-16 11:56:07 +0300 |
commit | ffc1d15d02ce27ec0c86016d08377c495cba89f0 (patch) | |
tree | 507fe0294be69f1ec54053bc497ee9d3f604566f | |
parent | ddd4f437336951f4bb03052d0f9c1ff4c6ed0499 (diff) |
[CSharpBinding] Improved parameter index recognition.
In case of non terminated parameter lists the last ')' isn't there.
-rw-r--r-- | main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterUtil.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterUtil.cs b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterUtil.cs index 8819453b88..da6b5106cb 100644 --- a/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterUtil.cs +++ b/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Features/ParameterHinting/ParameterUtil.cs @@ -69,9 +69,10 @@ namespace ICSharpCode.NRefactory6.CSharp return ParameterIndexResult.Invalid; int i = 0; + int j = 0; foreach (var child in invocation.ArgumentList.ChildNodesAndTokens ()) { if (child.Span.End > caretOffset) { - if (i == 0 && caretOffset <= child.SpanStart) + if (i == 0 && j <= 1) return ParameterIndexResult.First; return new ParameterIndexResult (usedNamedParameters != null ? usedNamedParameters.ToArray () : null, i + 1); } @@ -87,6 +88,10 @@ namespace ICSharpCode.NRefactory6.CSharp usedNamedParameters.Add (node.NameColon.Name.Identifier.Text); } } + j++; + } + if (j > 0) { + return new ParameterIndexResult (usedNamedParameters != null ? usedNamedParameters.ToArray () : null, i + 1); } return ParameterIndexResult.Invalid; } |