/// <summary>
 /// Creates the UIElement on call
 /// Uses PositionAffinity.Predecessor because we want the tag to be associated with the preceding character
 /// </summary>
 /// <param name="textView">The view of the editor</param>
 /// <param name="span">The span that has the location of the hint</param>
 /// <param name="key">The symbolkey associated with each parameter</param>
 public static InlineParameterNameHintsTag Create(string text, TextFormattingRunProperties format,
                                                  IWpfTextView textView, SnapshotSpan span, SymbolKey key,
                                                  InlineParameterNameHintsTaggerProvider taggerProvider)
 {
     return(new InlineParameterNameHintsTag(CreateElement(text, textView, format), textView,
                                            span, key, taggerProvider));
 }
Exemple #2
0
        public InlineParameterNameHintsTagger(InlineParameterNameHintsTaggerProvider taggerProvider, IWpfTextView textView, ITextBuffer buffer, ITagAggregator <InlineParameterNameHintDataTag> tagAggregator)
        {
            _cache = new List <ITagSpan <IntraTextAdornmentTag> >();

            _threadAffinitizedObject = new ForegroundThreadAffinitizedObject(taggerProvider.ThreadingContext);
            _inlineParameterNameHintsTaggerProvider = taggerProvider;

            _textView = textView;
            _buffer   = buffer;

            _tagAggregator      = tagAggregator;
            _formatMap          = taggerProvider.ClassificationFormatMapService.GetClassificationFormatMap(textView);
            _hintClassification = taggerProvider.ClassificationTypeRegistryService.GetClassificationType(InlineParameterNameHintsTag.TagId);
            _formatMap.ClassificationFormatMappingChanged += this.OnClassificationFormatMappingChanged;
            _tagAggregator.TagsChanged += OnTagAggregatorTagsChanged;
        }
        private InlineParameterNameHintsTag(
            FrameworkElement adornment,
            ITextView textView,
            SnapshotSpan span,
            SymbolKey key,
            InlineParameterNameHintsTaggerProvider taggerProvider)
            : base(adornment, removalCallback: null, PositionAffinity.Predecessor)
        {
            _textView           = textView;
            _span               = span;
            _key                = key;
            _streamingPresenter = taggerProvider.StreamingFindUsagesPresenter;
            _threadingContext   = taggerProvider.ThreadingContext;
            _toolTipService     = taggerProvider.ToolTipService;

            // Sets the tooltip to a string so that the tool tip opening event can be triggered
            // Tooltip value does not matter at this point because it immediately gets overwritten by the correct
            // information in the Border_ToolTipOpening event handler
            adornment.ToolTip         = "Quick info";
            adornment.ToolTipOpening += Border_ToolTipOpening;
        }