From d9a16a3335d9c805fb3f01cf11f66eaa647e02ff Mon Sep 17 00:00:00 2001 From: Ankita Khera Date: Wed, 12 Aug 2020 10:11:03 -0400 Subject: [PATCH] Removed stale code and added more comments --- .../InlineParameterNameHintsTag.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs b/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs index ba03e63ab15..831f51f3e1f 100644 --- a/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs +++ b/src/EditorFeatures/Core.Wpf/InlineParameterNameHints/InlineParameterNameHintsTag.cs @@ -21,21 +21,17 @@ namespace Microsoft.CodeAnalysis.Editor.InlineParameterNameHints internal class InlineParameterNameHintsTag : IntraTextAdornmentTag { public const string TagId = "inline parameter name hints"; + /// /// Creates the UIElement on call /// Uses PositionAffinity.Predecessor because we want the tag to be associated with the preceding character /// /// The name of the parameter associated with the argument public InlineParameterNameHintsTag(string text, IWpfTextView textView, TextFormattingRunProperties format) - : base(CreateElement(text, textView, format), removalCallback: AdornmentCallbackFunction, PositionAffinity.Predecessor) + : base(CreateElement(text, textView, format), removalCallback: null, PositionAffinity.Predecessor) { } - private static void AdornmentCallbackFunction(object tag, UIElement element) - { - // - } - private static UIElement CreateElement(string text, IWpfTextView textView, TextFormattingRunProperties format) { // Constructs the hint block which gets assigned parameter name and fontstyles according to the options @@ -63,12 +59,14 @@ private static UIElement CreateElement(string text, IWpfTextView textView, TextF HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, -0.20 * textView.LineHeight, 5, 0), Padding = new Thickness(1), + + // Need to set SnapsToDevicePixels and UseLayoutRounding to avoid unnecessary reformatting SnapsToDevicePixels = textView.VisualElement.SnapsToDevicePixels, UseLayoutRounding = textView.VisualElement.UseLayoutRounding, VerticalAlignment = VerticalAlignment.Center }; - // Need to set these properties to avoid unecessary reformatting because some dependancy properties + // Need to set these properties to avoid unnecessary reformatting because some dependancy properties // affect layout TextOptions.SetTextFormattingMode(border, TextOptions.GetTextFormattingMode(textView.VisualElement)); TextOptions.SetTextHintingMode(border, TextOptions.GetTextHintingMode(textView.VisualElement)); -- GitLab