public BackgroundColorVisualManager(IWpfTextView view, ITagAggregator<IClassificationTag> aggregator, IClassificationFormatMap formatMap,
                                            IVsFontsAndColorsInformationService fcService, IVsEditorAdaptersFactoryService adaptersService)
        {
            _view = view;
            _layer = view.GetAdornmentLayer("BackgroundColorFix");
            _aggregator = aggregator;
            _formatMap = formatMap;

            _fcService = fcService;
            _adaptersService = adaptersService;

            _view.LayoutChanged += OnLayoutChanged;

            // Here are the hacks for making the normal classification background go away:

            _formatMap.ClassificationFormatMappingChanged += (sender, args) =>
                {
                    if (!_inUpdate && _view != null && !_view.IsClosed)
                    {
                        _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap));
                    }
                };

            _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap));
        }
        public PlayMouseProcessor(IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService)
        {
            _wpfTextViewHost = wpfTextViewHost;
            _viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;

            _createTagAggregator = _viewTagAggregatorFactoryService.CreateTagAggregator<PlayGlyphTag>(_wpfTextViewHost.TextView);
        }
		public MarkerRenderer(
			ITextView textView,
			ITagAggregator<IVsVisibleTextMarkerTag> markerTagAggregator,
			ITagAggregator<IErrorTag> errorTagAggregator,
			EnvDTE.Debugger debugger,
			SimpleScrollBar scrollBar)
		{
			_textView = textView;
			_markerTagAggregator = markerTagAggregator;
			_errorTagAggregator = errorTagAggregator;
			_debugger = debugger;
			_scrollBar = scrollBar;

			// ... Pretty convoluted way to get the filename:
			ITextDocument doc;
			bool success = textView.TextBuffer.Properties.TryGetProperty<ITextDocument>(typeof(ITextDocument), out doc);
			if (success)
			{
				_filename = doc.FilePath;
			}
			else
			{
				_filename = "";
			}
		}
 internal SqlClassifier(ITagAggregator<NaturalTextTag> tagger, IClassificationTypeRegistryService classificationRegistry)
 {
     this.tagger = tagger;
     keywordType = classificationRegistry.GetClassificationType("sql-keyword");
     functionType = classificationRegistry.GetClassificationType("sql-function");
     variableType = classificationRegistry.GetClassificationType("sql-variable");
 }
 public GlyphMouseProcessor(IWpfTextViewHost host, IWpfTextViewMargin margin, ITagAggregator<IGlyphTag> aggregator)
 {
     this.theHost = host;
     this.theMargin = margin;
     this.tagAggregator = aggregator;
     this.theHost.Closed += OnTextViewHostClosed;
 }
Beispiel #6
0
        public Indenter(ITextView view, Options options, ITagAggregator<LexTag> lexTagAggregator)
        {
            _view = view;
              _options = options;
              _lexTags = lexTagAggregator;

              _indenters[TokenId.Type] = IndentChange.Inc;
              _indenters[TokenId.Interface] = IndentChange.Inc;
              _indenters[TokenId.Trait] = IndentChange.Inc;
              _indenters[TokenId.Primitive] = IndentChange.Inc;
              _indenters[TokenId.Class] = IndentChange.Inc;
              _indenters[TokenId.Actor] = IndentChange.Inc;
              _indenters[TokenId.Object] = IndentChange.Inc;
              _indenters[TokenId.New] = IndentChange.Inc;
              _indenters[TokenId.Fun] = IndentChange.Inc;
              _indenters[TokenId.Be] = IndentChange.Inc;
              _indenters[TokenId.Recover] = IndentChange.Inc;
              _indenters[TokenId.If] = IndentChange.Inc;
              _indenters[TokenId.Where] = IndentChange.Inc;
              _indenters[TokenId.Repeat] = IndentChange.Inc;
              _indenters[TokenId.Until] = IndentChange.Inc;
              _indenters[TokenId.For] = IndentChange.Inc;
              _indenters[TokenId.Match] = IndentChange.Inc;
              _indenters[TokenId.Trait] = IndentChange.Inc;
              _indenters[TokenId.With] = IndentChange.Inc;
              _indenters[TokenId.End] = IndentChange.Dec;
              _indenters[TokenId.DoubleArrow] = IndentChange.BackOne;
              _indenters[TokenId.Then] = IndentChange.BackOne;
              _indenters[TokenId.Else] = IndentChange.BackOne;
              _indenters[TokenId.ElseIf] = IndentChange.BackOne;
              _indenters[TokenId.Do] = IndentChange.BackOne;
        }
Beispiel #7
0
        /// <param name="adornmentAffinity">Determines whether adornments based on data tags with zero-length spans
        /// will stick with preceding or succeeding text characters.</param>
        protected IntraTextAdornmentTagTransformer(IWpfTextView view, ITagAggregator<TDataTag> dataTagger, PositionAffinity adornmentAffinity = PositionAffinity.Successor)
            : base(view)
        {
            this.adornmentAffinity = adornmentAffinity;
            this.dataTagger = dataTagger;

            this.dataTagger.TagsChanged += HandleDataTagsChanged;
        }
Beispiel #8
0
        public CustomUrlClassifier(ITextBuffer buffer, ITagAggregator <UrlTag> aggregator, IClassificationTypeRegistryService typeService)
        {
            _buffer = buffer;

            _aggregator = aggregator;

            _typeService = typeService;
        }
Beispiel #9
0
            public MarkFactory(IWpfTextView view, IViewTagAggregatorFactoryService aggregatorFactoryService)
            {
                _markerAggregator = aggregatorFactoryService.CreateTagAggregator <IVsVisibleTextMarkerTag>(view);

                _markerAggregator.TagsChanged += OnTagsChanged;

                view.Closed += OnClosed;
            }
Beispiel #10
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "QuickInfoErrorSource" /> class.
 /// </summary>
 /// <param name = "buffer">The buffer.</param>
 /// <param name = "aggregator">The aggregator.</param>
 /// <param name = "quickInfoSourceProvider">The quick info source provider.</param>
 protected QuickInfoSource(ITextBuffer buffer,
                           ITagAggregator <TTokenTag> aggregator,
                           QuickInfoSourceProvider <TTokenTag, TToken> quickInfoSourceProvider)
 {
     Aggregator = aggregator;
     QuickInfoSourceProvider = quickInfoSourceProvider;
     Buffer = buffer;
 }
Beispiel #11
0
        public MarksEnumerator(IViewTagAggregatorFactoryService aggregator_factory, ITextView view)
        {
            _view = view;
            _view.Closed += OnViewClosed;

            _aggregator = aggregator_factory.CreateTagAggregator<IVsVisibleTextMarkerTag>(view);
            _aggregator.BatchedTagsChanged += OnTagsChanged;
        }
Beispiel #12
0
 internal IdentifierTagger(ITextBuffer buffer, ITagAggregator <IDafnyResolverTag> tagAggregator)
 {
     _buffer                    = buffer;
     _snapshot                  = _buffer.CurrentSnapshot;
     _aggregator                = tagAggregator;
     _aggregator.TagsChanged   += new EventHandler <TagsChangedEventArgs>(_aggregator_TagsChanged);
     IdentifierTaggers[_buffer] = this;
 }
Beispiel #13
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            ITagAggregator <IDafnyResolverTag> tagAggregator = AggregatorFactory.CreateTagAggregator <IDafnyResolverTag>(buffer);
            // create a single tagger for each buffer.
            Func <ITagger <T> > sc = delegate() { return(new IdentifierTagger(buffer, tagAggregator) as ITagger <T>); };

            return(buffer.Properties.GetOrCreateSingletonProperty <ITagger <T> >(sc));
        }
Beispiel #14
0
        public MarksEnumerator(IViewTagAggregatorFactoryService aggregator_factory, ITextView view)
        {
            _view         = view;
            _view.Closed += OnViewClosed;

            _aggregator = aggregator_factory.CreateTagAggregator <IVsVisibleTextMarkerTag>(view);
            _aggregator.BatchedTagsChanged += OnTagsChanged;
        }
Beispiel #15
0
 public void Dispose()
 {
     if (_bufferTagAggregator != null)
     {
         _bufferTagAggregator.Dispose();
         _bufferTagAggregator = null;
     }
 }
Beispiel #16
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            ITagAggregator <IDafnyResolverTag> tagAggregator = AggregatorFactory.CreateTagAggregator <IDafnyResolverTag>(buffer);
            // create a single tagger for each buffer.
            Func <ITagger <T> > sc = delegate() { return(new ProgressTagger(buffer, _serviceProvider, tagAggregator, _textDocumentFactory) as ITagger <T>); };

            return(buffer.Properties.GetOrCreateSingletonProperty <ITagger <T> >(typeof(ProgressTagger), sc));
        }
Beispiel #17
0
        public AntlrQuickInfoSource(ITextBuffer buffer, ITagAggregator <AntlrTokenTag> aggregator)
        {
            _aggregator = aggregator;
            _buffer     = buffer;
            var path = buffer.GetFFN().Result;

            _grammar_description = LanguageServer.GrammarDescriptionFactory.Create(path);
        }
 public static IEnumerable <SnapshotSpan> GetCommentSnapshotSpans(
     this ITagAggregator <IClassificationTag> agg,
     NormalizedSnapshotSpanCollection source)
 {
     return(agg.GetTags(source)
            .Where(m => m.Tag.ClassificationType.Classification.ToLower().Contains("comment"))
            .SelectMany(ts => ts.Span.GetSpans(source[0].Snapshot)));
 }
 public BookmarkHeaderTagger(ITextBuffer buffer, ITagAggregator <IClassificationTag> agg, IContentType contentType)
 {
     configs          = ConfigService.Current.CommentConfiguration;
     buffer.Changed  += (sender, args) => HandleBufferChanged(args);
     tagAggregator    = agg;
     this.contentType = contentType;
     commentDelimiter = contentType.GetCommentDelimiter();
 }
 private static IEnumerable <SnapshotSpan> GetTags(
     ITagAggregator <NavigableHighlightTag> tagAggregator,
     SnapshotSpan span)
 {
     return(tagAggregator.GetTags(span)
            .SelectMany(tag => tag.Span.GetSpans(span.Snapshot.TextBuffer))
            .OrderBy(tag => tag.Start));
 }
 public EditDocumentationAdornmentTagger(IWpfTextView view, ITagAggregator <DocumentationTag> tagAggregator)
     : base(view)
 {
     this._tagAggregator         = tagAggregator;
     _tagAggregator.TagsChanged += OnTagsChanged;
     _buffer           = view.TextBuffer;
     _codyDocsFilename = view.TextBuffer.GetCodyDocsFileName();
 }
Beispiel #22
0
        /// <summary>
        /// Construct the classifier and define search tokens
        /// </summary>
        internal FanucGCodeClassifier(ITextBuffer buffer,
                                      ITagAggregator <FanucGCodeTokenTag> fanucGCodeTagAggregator,
                                      IClassificationTypeRegistryService typeService)
        {
            // I found an example of how to use builtin classifications here:
            // https://github.com/ponylang/VS-pony/blob/master/PonyLanguage/SyntaxHighlighter.cs

            // standard theme mapping:
            // PredefinedClassificationTypeNames.Comment is green
            // PredefinedClassificationTypeNames.Keyword is blue
            // PredefinedClassificationTypeNames.SymbolDefinition is green-blue (like C++/C# custom type)
            // PredefinedClassificationTypeNames.SymbolReference is bold dark green
            // PredefinedClassificationTypeNames.PreprocessorKeyword is light grey
            // PredefinedClassificationTypeNames.Identifier is uncoloured
            // PredefinedClassificationTypeNames.Operator is uncoloured
            // PredefinedClassificationTypeNames.String is red

            _buffer          = buffer;
            _aggregator      = fanucGCodeTagAggregator;
            _fanucGCodeTypes = new Dictionary <FanucGCodeTokenTypes, IClassificationType>();
            // note several different token types will map to the same classification type, eg the scanner will
            // pick out components of a comment including brackets, but we want the whole thing to be classified
            // as a comment editor format.
            _fanucGCodeTypes[FanucGCodeTokenTypes.CommentStart] = typeService.GetClassificationType(PredefinedClassificationTypeNames.Comment);
            _fanucGCodeTypes[FanucGCodeTokenTypes.CommentText]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.Comment);
            _fanucGCodeTypes[FanucGCodeTokenTypes.CommentEnd]   = typeService.GetClassificationType(PredefinedClassificationTypeNames.Comment);

            // functions - should possibly have their own format
            _fanucGCodeTypes[FanucGCodeTokenTypes.BuiltinFunction] = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.AxNum_Function]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.Ax_Function]     = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.SetVN_Function]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.BPrnt_Function]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.DPrnt_Function]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.POpen_Function]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.PClos_Function]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);

            // keywords
            _fanucGCodeTypes[FanucGCodeTokenTypes.If]    = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
            _fanucGCodeTypes[FanucGCodeTokenTypes.Then]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
            _fanucGCodeTypes[FanucGCodeTokenTypes.Goto]  = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
            _fanucGCodeTypes[FanucGCodeTokenTypes.While] = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
            _fanucGCodeTypes[FanucGCodeTokenTypes.Do]    = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
            _fanucGCodeTypes[FanucGCodeTokenTypes.End]   = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);

            // relational and logical operators, and modulus operator which has text rather than symbol
            _fanucGCodeTypes[FanucGCodeTokenTypes.RelationalOperator] = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
            _fanucGCodeTypes[FanucGCodeTokenTypes.LogicalOperator]    = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);
            _fanucGCodeTypes[FanucGCodeTokenTypes.Modulus]            = typeService.GetClassificationType(PredefinedClassificationTypeNames.Keyword);

            // system vars, constants and common vars should have their text coloured like C# string
            _fanucGCodeTypes[FanucGCodeTokenTypes.NamedVariable] = typeService.GetClassificationType(PredefinedClassificationTypeNames.String);

            // GCode prefixes need to stand out in the code
            _fanucGCodeTypes[FanucGCodeTokenTypes.ProgramNumberPrefix] = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
            _fanucGCodeTypes[FanucGCodeTokenTypes.LabelPrefix]         = typeService.GetClassificationType(PredefinedClassificationTypeNames.String);
            _fanucGCodeTypes[FanucGCodeTokenTypes.GCodePrefix]         = typeService.GetClassificationType(PredefinedClassificationTypeNames.SymbolDefinition);
        }
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            // Receive notification for Visual Studio theme change
            VSColorTheme.ThemeChanged += UpdateTheme;
            ITagAggregator <AntlrTokenTag> antlrTagAggregator =
                aggregatorFactory.CreateTagAggregator <AntlrTokenTag>(buffer);

            return(new AntlrClassifier(null, buffer, antlrTagAggregator, ClassificationTypeRegistry) as ITagger <T>);
        }
 public LanguageElementManager(ITextBuffer textBuffer, IBufferGraph bufferGraph, ITagAggregator<ILanguageElementTag> tagAggregator)
 {
     this.enabled = true;
     this.textBuffer = textBuffer;
     this.bufferGraph = bufferGraph;
     this.tagAggregator = tagAggregator;
     this.tagAggregator.TagsChanged += LanguageElementTagsChanged;
     this.textBuffer.Changed += SourceTextChanged;
 }
Beispiel #25
0
        public TokenCounter(ITextBuffer textBuffer, IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, string tokenText)
        {
            _textBuffer = textBuffer;
            _classifierAggregator = bufferTagAggregatorFactoryService.CreateTagAggregator<IClassificationTag>(textBuffer);
            _tokenText = tokenText;
            _tree = new TokenCountTree(this, _textBuffer.CurrentSnapshot);

            _classifierAggregator.BatchedTagsChanged += HandleClassifierTagsChanged;
        }
Beispiel #26
0
 internal SLangClassifier(ITextBuffer buffer, ITagAggregator <SLangTokenTag> SLangTagAggregator,
                          IStandardClassificationService typeService, IClassificationTypeRegistryService typeRegistry)
 {
     _buffer     = buffer;
     _snapshot   = buffer.CurrentSnapshot;
     _aggregator = SLangTagAggregator;
     InitializeClassifierMapping(typeService, typeRegistry);
     buffer.Changed += BufferChanged;
 }
 public LanguageElementManager(ITextBuffer textBuffer, IBufferGraph bufferGraph, ITagAggregator <ILanguageElementTag> tagAggregator)
 {
     this.enabled                    = true;
     this.textBuffer                 = textBuffer;
     this.bufferGraph                = bufferGraph;
     this.tagAggregator              = tagAggregator;
     this.tagAggregator.TagsChanged += LanguageElementTagsChanged;
     this.textBuffer.Changed        += SourceTextChanged;
 }
 void DisposeTagAggregator()
 {
     if (tagAggregator != null)
     {
         tagAggregator.BatchedTagsChanged -= TagAggregator_BatchedTagsChanged;
         tagAggregator.Dispose();
         tagAggregator = null;
     }
 }
Beispiel #29
0
        public FeatureClassifier(ITagAggregator <FeatureTokenTag> tagAggregator, IClassificationTypeRegistryService registry)
        {
            aggregator = tagAggregator;

            foreach (var Type in Styles.Keys)
            {
                featureTypes.Add(Type, registry.GetClassificationType(Styles[Type]));
            }
        }
Beispiel #30
0
        public TokenCounter(ITextBuffer textBuffer, IBufferTagAggregatorFactoryService bufferTagAggregatorFactoryService, string tokenText)
        {
            _textBuffer           = textBuffer;
            _classifierAggregator = bufferTagAggregatorFactoryService.CreateTagAggregator <IClassificationTag>(textBuffer);
            _tokenText            = tokenText;
            _tree = new TokenCountTree(this, _textBuffer.CurrentSnapshot);

            _classifierAggregator.BatchedTagsChanged += HandleClassifierTagsChanged;
        }
Beispiel #31
0
 public EditDocumentationCodeLangTagger(IWpfTextView view, ITagAggregator <DocumentationTag> tagAggregator)
 {
     this._tagAggregator         = tagAggregator;
     snapshot                    = view.TextBuffer.CurrentSnapshot;
     _tagAggregator.TagsChanged += OnTagsChanged;
     _buffer           = view.TextBuffer;
     _view             = view;
     _codyDocsFilename = view.TextBuffer.GetCodyDocsFileName();
 }
        public SkimNavigationService(ITextView textView, ITextBuffer textBuffer, ITagAggregator <IStructureTag> tagAggregator)
        {
            TextView      = textView;
            TextBuffer    = textBuffer;
            TagAggregator = tagAggregator;//TagAggregatorService.CreateTagAggregator<IStructureTag>(TextView);
            var tags = TagAggregator.GetTags(new SnapshotSpan(textBuffer.CurrentSnapshot, new Span(0, textBuffer.CurrentSnapshot.Length)));

            ActiveNode = Root = SyntaxTreeBuilder.BuildTree(textBuffer, tags);
        }
        public ErrorTagger(ITagAggregator <TokenTag>?tags) : base(tags)
        {
            if (tags == null)
            {
                throw new ArgumentNullException(nameof(tags));
            }

            _dataSource = new TableDataSource(tags.BufferGraph.TopBuffer.ContentType.DisplayName);
        }
Beispiel #34
0
 private ParamStorageAdornmentTagger(IWpfTextView view, IEditorFormatMap formatMap,
                                     ITagAggregator <ParamStorageTag> paramStorageTagger)
     : base(view)
 {
     this.paramStorageTagger              = paramStorageTagger;
     this.formatMap                       = formatMap;
     this.formatMap.FormatMappingChanged += (sender, args) => UpdateColors();
     UpdateColors();
 }
 private void OnTextViewHostClosed(object sender, EventArgs e)
 {
     if (this.tagAggregator != null)
     {
         this.tagAggregator.Dispose();
         this.tagAggregator = null;
     }
     this.theHost.Closed -= OnTextViewHostClosed;
 }
        public UnderlineClassifier(ITextBuffer textBuffer,
                               ITagAggregator<UnderlineTag> underlineTagAggregator,
                               IClassificationTypeRegistryService classificationTypeRegistryService) {
            TextBuffer = textBuffer;
            UnderlineTagAggregator = underlineTagAggregator;
            ClassificationTypeRegistryService = classificationTypeRegistryService;

            UnderlineTagAggregator.TagsChanged += OnUnderlineTagsChanged;
        }
Beispiel #37
0
 internal ExternalEditManager(IVimBuffer buffer, IVsTextLines vsTextLines, IViewTagAggregatorFactoryService tagAggregatorFactoryService)
 {
     _vsTextLines = vsTextLines;
     _tagAggregator = tagAggregatorFactoryService.CreateTagAggregator<ITag>(buffer.TextView);
     _buffer = buffer;
     _buffer.TextView.LayoutChanged += OnLayoutChanged;
     _buffer.SwitchedMode += OnSwitchedMode;
     _externalEditorAdapters.Add(new SnippetExternalEditorAdapter());
     _externalEditorAdapters.Add(new ResharperExternalEditorAdapter());
 }
 public AsmQuickInfoSource(
     ITextBuffer buffer,
     ITagAggregator <AsmTokenTag> aggregator,
     ILabelGraph labelGraph)
 {
     this._sourceBuffer = buffer;
     this._aggregator   = aggregator;
     this._labelGraph   = labelGraph;
     this._asmDudeTools = AsmDudeTools.Instance;
 }
Beispiel #39
0
        internal SquigglesTagger(ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory)
        {
            this._sourceBuffer = buffer;
            ITagAggregator <SLangTokenTag> sc()
            {
                return(aggregatorFactory.CreateTagAggregator <SLangTokenTag>(buffer));
            }

            this._aggregator = buffer.Properties.GetOrCreateSingletonProperty(sc);
        }
Beispiel #40
0
 internal ExternalEditManager(IVimBuffer buffer, IVsTextLines vsTextLines, IViewTagAggregatorFactoryService tagAggregatorFactoryService)
 {
     _vsTextLines   = vsTextLines;
     _tagAggregator = tagAggregatorFactoryService.CreateTagAggregator <ITag>(buffer.TextView);
     _buffer        = buffer;
     _buffer.TextView.LayoutChanged += OnLayoutChanged;
     _buffer.SwitchedMode           += OnSwitchedMode;
     _externalEditorAdapters.Add(new SnippetExternalEditorAdapter());
     _externalEditorAdapters.Add(new ResharperExternalEditorAdapter());
 }
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            Func <ITagger <T> > sc = delegate() {
                ITagAggregator <AsmTokenTag> aggregator = AsmDudeToolsStatic.getAggregator(buffer, _aggregatorFactory);
                ILabelGraph labelGraph = AsmDudeToolsStatic.getLabelGraph(buffer, _aggregatorFactory, _docFactory, _contentService);
                return(new LabelErrorTagger(buffer, aggregator, labelGraph) as ITagger <T>);
            };

            return(buffer.Properties.GetOrCreateSingletonProperty(sc));
        }
        GoToDefinitionMouseProcessor(IWpfTextView textView, TextViewConnectionListener textViewConnectionListener, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService) {
            _textView      = textView;
            _tagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator<GoToDefinitionTag>(textView);
            _keyState      = ModifierKeyState.GetStateForView(textView, textViewConnectionListener);

            _textView.LostAggregateFocus += OnTextViewLostAggregateFocus; 
            _keyState.KeyStateChanged    += OnKeyStateChanged;

            textViewConnectionListener.AddDisconnectAction(textView, RemoveMouseProcessorForView);
        }
 public TestGlyphMouseProcessor(
     IWpfTextViewHost viewHost,
     IViewTagAggregatorFactoryService viewTagService,
     DTE dte
     )
 {
     _viewHost = viewHost;
     _viewTagService = viewTagService;
     _dte = (DTE2) dte;
     _testTagAggregator = viewTagService.CreateTagAggregator<TestTag>(
         viewHost.TextView);
 }
        public UrlCommandFilter(IVsTextView textViewAdapter, ITextView textView, UrlCommandFilterProvider provider)
            : base(textViewAdapter)
        {
            if (textView == null)
                throw new ArgumentNullException("textView");
            if (provider == null)
                throw new ArgumentNullException("provider");

            _textView = textView;
            _serviceProvider = provider.ServiceProvider;
            _urlTagAggregator = provider.ViewTagAggregatorFactoryService.CreateTagAggregator<IUrlTag>(textView);
        }
 internal ExternalEditMonitor(
     IVimBuffer buffer,
     Result<IVsTextLines> vsTextLines,
     ReadOnlyCollection<IExternalEditAdapter> externalEditorAdapters,
     ITagAggregator<ITag> tagAggregator)
 {
     _vsTextLines = vsTextLines;
     _externalEditorAdapters = externalEditorAdapters;
     _tagAggregator = tagAggregator;
     _buffer = buffer;
     _buffer.TextView.LayoutChanged += OnLayoutChanged;
     _buffer.SwitchedMode += OnSwitchedMode;
 }
 public RegistrySuggestedActions(
     ITextView view, ITextBuffer buffer,
     ITagAggregator<IErrorTag> aggregator,
     IEnumerable<ICodeFixProvider> codeFixProviders,
     IEnumerable<ICodeRefactoringProvider> refactoringProviders
 )
 {
     _view = view;
     _buffer = buffer;
     _aggregator = aggregator;
     _codeFixProviders = codeFixProviders;
     _refactoringProviders = refactoringProviders;
 }
Beispiel #47
0
        public MarkerToolTipHandler(MarkerToolTipHandlerProvider provider, ThreadFixPlugin threadFixPlugin, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
        {
            _threadFixPlugin = threadFixPlugin;
            _textViewHost = wpfTextViewHost;
            _margin = margin;
            _glyphTagAggregator = provider.ViewTagAggregatorFactoryService.CreateTagAggregator<MarkerTag>(wpfTextViewHost.TextView);
            _popup = new Popup
            {
                IsOpen = false,
                Visibility = Visibility.Hidden
            };

            _textViewHost.Closed += (sender, e) => _glyphTagAggregator.Dispose();
        }
        DiagnosticService(IWpfTextView textView, IComponentModel componentModel) {
            var viewTagAggregatorFactoryService = componentModel.GetService<IViewTagAggregatorFactoryService>();
            var outliningManagerService         = componentModel.GetService<IOutliningManagerService>();

            _textView           = textView;
            _errorTagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator<DiagnosticErrorTag>(textView);
            _outliningManager   = outliningManagerService.GetOutliningManager(textView);
            _diagnosticMapping  = new Dictionary<DiagnosticSeverity, ReadOnlyCollection<IMappingTagSpan<DiagnosticErrorTag>>>();
            _waitingForAnalysis = true;
            
            _textView.Closed                       += OnTextViewClosed;
            _textView.TextBuffer.Changed           += OnTextBufferChanged;
            _errorTagAggregator.BatchedTagsChanged += OnBatchedTagsChanged;
        }
		public ProgressiveScroll(
			IWpfTextViewMargin containerMargin,
			IWpfTextView textView,
			IOutliningManager outliningManager,
			ITagAggregator<ChangeTag> changeTagAggregator,
			ITagAggregator<IVsVisibleTextMarkerTag> markerTagAggregator,
			ITagAggregator<IErrorTag> errorTagAggregator,
			EnvDTE.Debugger debugger,
			SimpleScrollBar scrollBar,
			ColorSet colors)
		{
			_containerMargin = containerMargin;

			ProgressiveScrollDict.Add(this);

			Colors = colors;
			_textView = textView;
			_scrollBar = scrollBar;
			_markerTagAggregator = markerTagAggregator;
			_errorTagAggregator = errorTagAggregator;

			RegisterEvents();
			InitSettings();

			_textRenderer = new TextRenderer(this, _textView, outliningManager);
			if (Options.RenderTextEnabled)
			{
				Visuals.Add(_textRenderer.TextVisual);
			}

			MarksVisual = new DrawingVisual();
			Visuals.Add(MarksVisual);

			_changeRenderer = new ChangeRenderer(_textView, changeTagAggregator, scrollBar);
			_highlightRenderer = new HighlightRenderer(_textView, scrollBar);
			_markerRenderer = new MarkerRenderer(_textView, markerTagAggregator, errorTagAggregator, debugger, scrollBar);

			foreach (var visual in Visuals)
			{
				AddVisualChild(visual);
			}
		}
        public InheritanceGlyphMouseHandler(InheritanceGlyphMouseHandlerProvider provider, IWpfTextViewHost textViewHost, IWpfTextViewMargin margin)
        {
            if (provider == null)
                throw new ArgumentNullException("provider");
            if (textViewHost == null)
                throw new ArgumentNullException("textViewHost");
            if (margin == null)
                throw new ArgumentNullException("margin");

            _provider = provider;
            _textViewHost = textViewHost;
            _margin = margin;
            _glyphTagAggregator = provider.ViewTagAggregatorFactoryService.CreateTagAggregator<IInheritanceTag>(textViewHost.TextView);
            _popup = new Popup()
                {
                    IsOpen = false,
                    Visibility = Visibility.Hidden
                };

            _lastLeftButtonWasDoubleClick = true;
            _textViewHost.Closed += (sender, e) => _glyphTagAggregator.Dispose();
        }
 private void OnTextViewHostClosed(object sender, EventArgs e)
 {
     if ( this.tagAggregator != null ) {
       this.tagAggregator.Dispose();
       this.tagAggregator = null;
     }
     this.theHost.Closed -= OnTextViewHostClosed;
 }
 public JetQuickInfoSource(ITextBuffer buffer, ITagAggregator<JetTokenTag> aggregator)
 {
     _aggregator = aggregator;
     _buffer = buffer;
 }
Beispiel #53
0
 private bool CheckForPrefixTag(
 ITagAggregator<IClassificationTag> tagAggregator,
 SnapshotSpan span)
 {
     String text = span.GetText();
       if ( text.StartsWith("<") || text.Contains(":") ) {
     return false;
       }
       var firstMatch = from tagSpan in tagAggregator.GetTags(span)
                let tagName = tagSpan.Tag.ClassificationType.Classification
                where tagName == Constants.XML_PREFIX
                select tagSpan;
       return firstMatch.FirstOrDefault() != null;
 }
 public PkgDefTokenQuickInfoSource(ITextBuffer buffer, ITagAggregator<PkgDefTokenTag> aggregator)
 {
     _aggregator = aggregator;
     _buffer = buffer;
 }
		public ChangeRenderer(ITextView textView, ITagAggregator<ChangeTag> changeTagAggregator, SimpleScrollBar scrollBar)
		{
			_textView = textView;
			_changeTagAggregator = changeTagAggregator;
			_scrollBar = scrollBar;
		}
Beispiel #56
0
 public OokQuickInfoSource(ITextBuffer buffer, ITagAggregator<DotQLTokenTag> aggregator)
 {
     _aggregator = aggregator;
     _buffer = buffer;
 }
Beispiel #57
0
 public DafnyQuickInfoSource(ITextBuffer buffer, ITagAggregator<DafnyTokenTag> aggregator)
 {
     _aggregator = aggregator;
       _buffer = buffer;
 }
 public HighlightingNavigationManager(ITextView textView, ITagAggregator<HighlightTag> tagAggregator)
 {
     _textView = textView;
     _tagAggregator = tagAggregator;
 }
Beispiel #59
0
		void Initialize() {
			if (mouseProcessorCollection != null)
				return;
			iconCanvas = new Canvas { Background = Brushes.Transparent };
			Children.Add(iconCanvas);
			mouseProcessorCollection = new MouseProcessorCollection(VisualElement, null, new DefaultMouseProcessor(), CreateMouseProcessors(), null);
			wpfTextViewHost.TextView.TextDataModel.ContentTypeChanged += TextDataModel_ContentTypeChanged;
			lineInfos = new Dictionary<object, LineInfo>();
			tagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator<IGlyphTag>(wpfTextViewHost.TextView);
			editorFormatMap = editorFormatMapService.GetEditorFormatMap(wpfTextViewHost.TextView);
			InitializeGlyphFactories(null, wpfTextViewHost.TextView.TextDataModel.ContentType);
		}
Beispiel #60
0
        /// <summary>
        /// Creates a square image and attaches an event handler to the layout changed event that
        /// adds the the square in the upper right-hand corner of the TextView via the adornment layer
        /// </summary>
        /// <param name="view">The <see cref="IWpfTextView"/> upon which the adornment will be drawn</param>
        public TestAdorn(IWpfTextView view, TextInvisTagger tit, IViewTagAggregatorFactoryService tafs)
        {
            _view = view;
            _tit = tit;

            tagAggregator = tafs.CreateTagAggregator<TextInvisTag>(_view);

            //Grab a reference to the adornment layer that this adornment should be added to
            _adornmentLayer = view.GetAdornmentLayer("FocusArea");

            _view.ViewportHeightChanged += delegate { this.onSizeChange(); };
            _view.ViewportWidthChanged += delegate { this.onSizeChange(); };

            //_tit.ScrollNumberFixed += delegate { this.onSizeChange(); };
            _view.LayoutChanged += delegate { this.onSizeChange(); };            //may have problems
            //_view.LayoutChanged += new EventHandler<TextViewLayoutChangedEventArgs>(_view_LayoutChanged);
        }