Browse Source

fix parameter highlighting bug and add word wrap if highlighting is used

4.1
Siegfried Pammer 15 years ago
parent
commit
47e59c6a9a
  1. 9
      src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightItem.cs

9
src/Main/Base/Project/Src/Editor/CodeCompletion/MethodInsightItem.cs

@ -1,6 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Documents; using System.Windows.Documents;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
@ -62,14 +63,16 @@ namespace ICSharpCode.SharpDevelop.Editor.CodeCompletion
param = ambience.Convert(method.Parameters[highlightParameter]); param = ambience.Convert(method.Parameters[highlightParameter]);
if (!string.IsNullOrEmpty(param)) { if (!string.IsNullOrEmpty(param)) {
string[] parts = headerText.Split(new[] { param }, StringSplitOptions.None); // append ',' or ')' to avoid missing highlighting if there are multiple parameter names starting with the same substring.
string[] parts = headerText.Split(new[] { param + (method.Parameters.Count - 1 == highlightParameter ? ')' : ',') }, StringSplitOptions.None);
if (parts.Length != 2) if (parts.Length != 2)
return headerText; return headerText;
return new Span() { return new TextBlock { // add text wrapping
TextWrapping = TextWrapping.Wrap,
Inlines = { Inlines = {
parts[0], parts[0],
new Bold() { Inlines = { param } }, new Bold() { Inlines = { param } },
parts[1] (method.Parameters.Count - 1 == highlightParameter ? ')' : ',') + parts[1]
} }
}; };
} }

Loading…
Cancel
Save