Main R validator: performs syntax check, produces results that then sent to the task list and tagger that creates squiggles. Works asynchronously except the final part that pushes actual task items to the IDE. Additional validators can be added via MEF exports. Validator listens to tree updated events and schedules validation passes for next idle slot. Next idle validation thread starts and performas its work. Validator also listens to changes in settings which may turn validation on or off.
Exemplo n.º 1
0
        /// <summary>
        /// Retrieves (or creates) the validator (syntax checker)
        /// for the document that is associated with the text buffer
        /// </summary>
        /// <param name="textBuffer">Text buffer</param>
        public static TreeValidator EnsureFromTextBuffer(ITextBuffer textBuffer, IEditorTree editorTree)
        {
            TreeValidator validator = ServiceManager.GetService <TreeValidator>(textBuffer);

            if (validator == null)
            {
                validator = new TreeValidator(editorTree);
            }

            return(validator);
        }
Exemplo n.º 2
0
        public REditorDocument(ITextBuffer textBuffer) {
            EditorShell.Current.CompositionService.SatisfyImportsOnce(this);

            this.TextBuffer = textBuffer;

            IsClosed = false;
            TextDocumentFactoryService.TextDocumentDisposed += OnTextDocumentDisposed;

            ServiceManager.AddService<REditorDocument>(this, TextBuffer);

            _editorTree = new EditorTree(textBuffer);
            if (REditorSettings.SyntaxCheckInRepl) {
                _validator = new TreeValidator(this.EditorTree);
            }

            _editorTree.Build();

            RCompletionEngine.Initialize();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Retrieves (or creates) the validator (syntax checker) 
        /// for the document that is associated with the text buffer
        /// </summary>
        /// <param name="textBuffer">Text buffer</param>
        public static TreeValidator EnsureFromTextBuffer(ITextBuffer textBuffer, IEditorTree editorTree)
        {
            TreeValidator validator = ServiceManager.GetService<TreeValidator>(textBuffer);
            if (validator == null)
            {
                validator = new TreeValidator(editorTree);
            }

            return validator;
        }
Exemplo n.º 4
0
        public REditorDocument(ITextBuffer textBuffer, ICoreShell shell) {
            _shell = shell;
            _textDocumentFactoryService = _shell.ExportProvider.GetExportedValue<ITextDocumentFactoryService>();
            _textDocumentFactoryService.TextDocumentDisposed += OnTextDocumentDisposed;

            TextBuffer = textBuffer;
            IsClosed = false;

            ServiceManager.AddService(this, TextBuffer, shell);
            var clh = ServiceManager.GetService<IContainedLanguageHost>(textBuffer);

            _editorTree = new EditorTree(textBuffer, shell, new ExpressionTermFilter(clh));
            if (REditorSettings.SyntaxCheckInRepl) {
                _validator = new TreeValidator(EditorTree, shell);
            }

            _editorTree.Build();
        }