Example #1
0
        public Antlr4EditorNavigationSource([NotNull] Antlr4EditorNavigationSourceProvider provider, [NotNull] ITextBuffer textBuffer)
        {
            Requires.NotNull(provider, nameof(provider));
            Requires.NotNull(textBuffer, nameof(textBuffer));

            _provider   = provider;
            _textBuffer = textBuffer;

            _parserRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule);
            _lexerRuleNavigationType  = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule);

            string assemblyName = typeof(Antlr4EditorNavigationSource).Assembly.GetName().Name;

            _lexerRuleGlyph  = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName)));
            _parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName)));

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);

            var lastParseResult = _backgroundParser.LastResult;

            if (lastParseResult != null)
            {
                UpdateNavigationTargets(lastParseResult);
            }
        }
        public Antlr4EditorNavigationSource(Antlr4EditorNavigationSourceProvider provider, ITextBuffer textBuffer)
        {
            Contract.Requires<ArgumentNullException>(provider != null, "provider");
            Contract.Requires<ArgumentNullException>(textBuffer != null, "textBuffer");

            _provider = provider;
            _textBuffer = textBuffer;

            _parserRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule);
            _lexerRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule);

            string assemblyName = typeof(Antlr4EditorNavigationSource).Assembly.GetName().Name;
            _lexerRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName)));
            _parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName)));

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);
        }
        public Antlr4EditorNavigationSource(Antlr4EditorNavigationSourceProvider provider, ITextBuffer textBuffer)
        {
            Contract.Requires <ArgumentNullException>(provider != null, "provider");
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");

            _provider   = provider;
            _textBuffer = textBuffer;

            _parserRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule);
            _lexerRuleNavigationType  = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule);

            string assemblyName = typeof(Antlr4EditorNavigationSource).Assembly.GetName().Name;

            _lexerRuleGlyph  = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName)));
            _parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName)));

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);
        }