public EditorErrorTagger(ITextBuffer textBuffer)
        {
            EditorShell.Current.CompositionService.SatisfyImportsOnce(this);

            _document = REditorDocument.FromTextBuffer(textBuffer);
            _document.DocumentClosing            += OnDocumentClosing;
            _document.EditorTree.UpdateCompleted += OnTreeUpdateCompleted;
            _document.EditorTree.NodesRemoved    += OnNodesRemoved;
            _errorTags = new ErrorTagCollection(_document.EditorTree);

            _textBuffer          = _document.EditorTree.TextBuffer;
            _textBuffer.Changed += OnTextBufferChanged;

            _fireCodeMarkerUponCompletion = true;

            // Don't push syntax errors to the Error List in transient
            // documents such as in document attached to a projected buffer
            // in the R interactive window
            if (TaskList != null)
            {
                var view = _document.GetFirstView();
                if (view != null && !view.IsRepl())
                {
                    TaskList.AddTaskSource(this);
                }
            }

            TreeValidator validator = TreeValidator.EnsureFromTextBuffer(_textBuffer, _document.EditorTree);

            validator.Cleared        += OnCleared;
            ResultsQueue              = validator.ValidationResults;
            EditorShell.Current.Idle += OnIdle;

            ServiceManager.AddService <EditorErrorTagger>(this, textBuffer);
        }
Example #2
0
        public EditorErrorTagger(ITextBuffer textBuffer, IEditorTaskList taskList, ICoreShell shell)
        {
            _taskList = taskList;
            _shell    = shell;
            _settings = _shell.GetService <IREditorSettings>();

            _document = REditorDocument.FromTextBuffer(textBuffer);
            _document.DocumentClosing            += OnDocumentClosing;
            _document.EditorTree.UpdateCompleted += OnTreeUpdateCompleted;
            _document.EditorTree.NodesRemoved    += OnNodesRemoved;
            _errorTags = new ErrorTagCollection(_document.EditorTree);

            _textBuffer          = _document.EditorTree.TextBuffer;
            _textBuffer.Changed += OnTextBufferChanged;

            _fireCodeMarkerUponCompletion = true;

            // Don't push syntax errors to the Error List in transient
            // documents such as in document attached to a projected buffer
            // in the R interactive window
            if (_taskList != null)
            {
                var view = _document.GetFirstView();
                if (view != null && !view.IsRepl())
                {
                    _taskList.AddTaskSource(this);
                }
            }

            TreeValidator validator = TreeValidator.EnsureFromTextBuffer(_textBuffer, _document.EditorTree, shell);

            validator.Cleared += OnCleared;
            ResultsQueue       = validator.ValidationResults;
            _shell.Idle       += OnIdle;
        }