Esempio n. 1
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            // Provide highlighting only on the top buffer
            // HTML files for instance will fail here
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            // This checks for diff/merge type views
            if (textView.Roles.ContainsAny(ProgressiveScrollFactory.RejectedRoles))
            {
                return(null);
            }

            ITextStructureNavigator textStructureNavigator =
                TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);

            IClassificationType classificationType = Registry.GetClassificationType(ClassificationNames.Highlights);

            var tagger = new HighlightWordTagger(textView as IWpfTextView, buffer, TextSearchService, textStructureNavigator, classificationType);

            Taggers[textView] = tagger;
            return(tagger as ITagger <T>);
        }
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer)
            where T : ITag
        {
            var textStructureNavigator = TextStructureNavigatorSelector.GetTextStructureNavigator(textView.TextBuffer);

            var classifier = VsServiceManager.GetScriptColorizer(buffer) ?? ClassifierAggregatorService.GetClassifier(buffer);

            return(new HighlightWordTagger(textView, buffer, TextSearchService, textStructureNavigator, classifier) as ITagger <T>);
        }
Esempio n. 3
0
        public void VsTextViewCreated(IVsTextView textViewAdapter)
        {
            IWpfTextView textView = EditorAdaptersFactory.GetWpfTextView(textViewAdapter);

            if (textView == null)
            {
                return;
            }
            ITextStructureNavigator navigator = TextStructureNavigatorSelector.GetTextStructureNavigator(textView.TextBuffer);

            AddCommandFilter(textViewAdapter, new MyCommandFilter(textView, navigator, ServiceProvider));
        }
Esempio n. 4
0
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            //provide highlighting only on the top buffer
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }

            ITextStructureNavigator textStructureNavigator =
                TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);

            return(new HighlightWordTagger(textView, WpfTextView, buffer, TextSearchService, textStructureNavigator) as ITagger <T>);
        }
        public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
        {
            if (textView.TextBuffer != buffer)
            {
                return(null);
            }
            var textStructureNavigator = TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);

            return((ITagger <T>) new OccurrenceTagger(textView,
                                                      buffer,
                                                      TextSearchService,
                                                      textStructureNavigator,
                                                      ClassificationRegistry,
                                                      Options));
        }
 public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag
 {
     if (textView.TextBuffer != buffer)
     {
         return(null);
     }
     else
     {
         return(buffer.Properties.GetOrCreateSingletonProperty(() =>
         {
             var aggregator = AggregatorFactory.CreateTagAggregator <IGLSLTag>(buffer);
             var navigator = TextStructureNavigatorSelector.GetTextStructureNavigator(buffer);
             return new GLSLHighlighter(textView, buffer, TextSearchService, navigator, aggregator) as ITagger <T>;
         }));
     }
 }
 /// <summary>
 /// Returns a TextStructureNavigator for the given TextBuffer
 /// This is a service by VisualStudio for fast navigation in structured texts
 /// </summary>
 internal ITextStructureNavigator GetTextStructureNavigator(ITextBuffer buffer)
 {
     return(TextStructureNavigatorSelector.GetTextStructureNavigator(buffer));
 }