Ejemplo n.º 1
0
        private InlineHintsTag(
            FrameworkElement adornment,
            ITextView textView,
            SnapshotSpan span,
            InlineHint hint,
            InlineHintsTaggerProvider taggerProvider)
            : base(adornment,
                   removalCallback: null,
                   PositionAffinity.Predecessor)
        {
            _textView       = textView;
            _span           = span;
            _hint           = hint;
            _taggerProvider = taggerProvider;

            // 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;

            if (_hint.ReplacementTextChange is not null)
            {
                adornment.MouseLeftButtonDown += Adornment_MouseLeftButtonDown;
            }
        }
Ejemplo n.º 2
0
        public InlineHintsTagger(
            InlineHintsTaggerProvider taggerProvider,
            IWpfTextView textView,
            ITextBuffer buffer,
            ITagAggregator <InlineHintDataTag> tagAggregator
            )
        {
            _cache = new List <ITagSpan <IntraTextAdornmentTag> >();

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

            _textView = textView;
            _buffer   = buffer;

            _tagAggregator = tagAggregator;
            _formatMap     = taggerProvider.ClassificationFormatMapService.GetClassificationFormatMap(
                textView
                );
            _hintClassification =
                taggerProvider.ClassificationTypeRegistryService.GetClassificationType(
                    InlineHintsTag.TagId
                    );
            _formatMap.ClassificationFormatMappingChanged +=
                this.OnClassificationFormatMappingChanged;
            _tagAggregator.TagsChanged += OnTagAggregatorTagsChanged;
        }
Ejemplo n.º 3
0
 /// <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>
 public static InlineHintsTag Create(
     InlineHint hint,
     TextFormattingRunProperties format,
     IWpfTextView textView,
     SnapshotSpan span,
     InlineHintsTaggerProvider taggerProvider,
     IClassificationFormatMap formatMap,
     bool classify
     )
 {
     return(new InlineHintsTag(
                CreateElement(
                    hint.DisplayParts,
                    textView,
                    format,
                    formatMap,
                    taggerProvider.TypeMap,
                    classify
                    ),
                textView,
                span,
                hint,
                taggerProvider
                ));
 }
Ejemplo n.º 4
0
        private InlineHintsTag(
            FrameworkElement adornment,
            ITextView textView,
            SnapshotSpan span,
            InlineHint hint,
            InlineHintsTaggerProvider taggerProvider)
            : base(adornment,
                   removalCallback: null,
                   topSpace: null,
                   baseline: null,
                   // Make the adornment take up the entire line height.  This will cause it to overlap the line
                   // highlighting box on both the top and bottom.  Below, when we create the border object, we will
                   // actually give it a margin so that places itself within the highlight lines properly.
                   textHeight: textView.LineHeight,
                   bottomSpace: null,
                   PositionAffinity.Predecessor)
        {
            _textView           = textView;
            _span               = span;
            _hint               = hint;
            _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;
        }
Ejemplo n.º 5
0
        private InlineHintsTag(
            FrameworkElement adornment,
            ITextView textView,
            SnapshotSpan span,
            InlineHint hint,
            InlineHintsTaggerProvider taggerProvider)
            : base(adornment, removalCallback: null, PositionAffinity.Predecessor)
        {
            _textView           = textView;
            _span               = span;
            _hint               = hint;
            _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;
        }