Ejemplo n.º 1
0
        private void HandleViewChanged(object sender, ViewChangedEventArgs e)
        {
            BackgroundParser = null;
            Tagger           = null;
            Tokens3          = null;
            Tokens4          = null;
            Snapshot         = null;
            Tree.Dispatcher.Invoke(
                (Action)(() =>
            {
                try
                {
                    Tree.Items.Clear();
                }
                catch (Exception ex)
                {
                    if (ErrorHandler.IsCriticalException(ex))
                    {
                        throw;
                    }
                }
            }));

            if (e.NewView != null)
            {
                var backgroundParser = BackgroundParserFactoryService.GetBackgroundParser(e.NewView.TextBuffer);
                BackgroundParser = backgroundParser;
                if (backgroundParser != null)
                {
                    Tagger = AstReferenceTaggerProvider.GetAstReferenceTagger(e.NewView.TextBuffer);
                    backgroundParser.ParseComplete += WeakEvents.AsWeak <ParseResultEventArgs>(HandleParseComplete, eh => backgroundParser.ParseComplete -= eh);
                    backgroundParser.RequestParse(false);
                }
            }
        }
        public IEditorNavigationSource TryCreateEditorNavigationSource(ITextBuffer textBuffer)
        {
            var backgroundParser = BackgroundParserFactoryService.GetBackgroundParser(textBuffer) as Antlr4BackgroundParser;

            if (backgroundParser == null)
            {
                return(null);
            }

            return(new Antlr4EditorNavigationSource(textBuffer, backgroundParser, EditorNavigationTypeRegistryService));
        }
        public IEditorNavigationSource TryCreateEditorNavigationSource(ITextBuffer textBuffer)
        {
            var backgroundParser = BackgroundParserFactoryService.GetBackgroundParser(textBuffer);

            if (backgroundParser == null)
            {
                return(null);
            }

            return(new JavaEditorNavigationSource(textBuffer, backgroundParser, this));
        }
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            if (typeof(T) == typeof(ILanguageElementTag))
            {
                Func <ITagger <ILanguageElementTag> > creator =
                    () =>
                {
                    var backgroundParser = BackgroundParserFactoryService.GetBackgroundParser(buffer);
                    return(new AntlrLanguageElementTagger(buffer, backgroundParser, OutputWindowService));
                };
                return((ITagger <T>)buffer.Properties.GetOrCreateSingletonProperty(creator));
            }

            return(null);
        }
Ejemplo n.º 5
0
        private void OnViewChanged(object sender, ViewChangedEventArgs e)
        {
            BackgroundParser = null;

            if (e.NewView != null)
            {
                var backgroundParser = BackgroundParserFactoryService.GetBackgroundParser(e.NewView.TextBuffer);
                BackgroundParser = backgroundParser;
                if (backgroundParser != null)
                {
                    ToolWindowPane.Caption          = "Markdown Preview - ";
                    backgroundParser.ParseComplete += WeakEvents.AsWeak <ParseResultEventArgs>(HandleBackgroundParseComplete, eh => backgroundParser.ParseComplete -= eh);
                    backgroundParser.RequestParse(false);
                }
            }

            CurrentView = e.NewView;

            if (BackgroundParser == null)
            {
                ToolWindowPane.Caption = "Markdown Preview";
                Browser.NavigateToString(EmptyWindowHtml);
            }
        }
Ejemplo n.º 6
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer) where T : ITag
        {
            Func <StringTemplateOutliningTagger> creator = () => new StringTemplateOutliningTagger(buffer, BackgroundParserFactoryService.GetBackgroundParser(buffer), this);

            return(buffer.Properties.GetOrCreateSingletonProperty(creator) as ITagger <T>);
        }
Ejemplo n.º 7
0
        public IQuickInfoSource TryCreateQuickInfoSource(ITextBuffer textBuffer)
        {
            var backgroundParser = BackgroundParserFactoryService.GetBackgroundParser(textBuffer) as Antlr4BackgroundParser;

            return(new Antlr4QuickInfoSource(textBuffer, backgroundParser, AggregatorFactory.CreateTagAggregator <ClassificationTag>(textBuffer)));
        }
Ejemplo n.º 8
0
        public ITagger <T> CreateTagger <T>(ITextBuffer buffer)
            where T : ITag
        {
            Func <StringTemplateSemanticTagger> creator = () => new StringTemplateSemanticTagger(buffer, BackgroundParserFactoryService.GetBackgroundParser(buffer), ClassificationTypeRegistryService);

            return(buffer.Properties.GetOrCreateSingletonProperty(creator) as ITagger <T>);
        }
        protected override IntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            AntlrIntellisenseController controller = new AntlrIntellisenseController(textView, this, (AntlrBackgroundParser)BackgroundParserFactoryService.GetBackgroundParser(textView.TextBuffer));

            textView.Properties[typeof(AntlrIntellisenseController)] = controller;
            return(controller);
        }
Ejemplo n.º 10
0
        protected override IntellisenseController TryCreateIntellisenseController(ITextView textView, IList <ITextBuffer> subjectBuffers)
        {
            Func <Antlr4IntellisenseController> factory =
                () =>
            {
                return(new Antlr4IntellisenseController(textView, this, (Antlr4BackgroundParser)BackgroundParserFactoryService.GetBackgroundParser(textView.TextBuffer)));
            };

            return(textView.Properties.GetOrCreateSingletonProperty(factory));
        }
Ejemplo n.º 11
0
        protected override IntellisenseController TryCreateIntellisenseController([NotNull] ITextView textView, [NotNull] IList <ITextBuffer> subjectBuffers)
        {
            Requires.NotNull(textView, nameof(textView));
            Requires.NotNull(subjectBuffers, nameof(subjectBuffers));

            AntlrIntellisenseController controller = new AntlrIntellisenseController(textView, this, (AntlrBackgroundParser)BackgroundParserFactoryService.GetBackgroundParser(textView.TextBuffer));

            textView.Properties[typeof(AntlrIntellisenseController)] = controller;
            return(controller);
        }