public EditorErrorTagger(ITextBuffer textBuffer, IEditorTaskList taskList, IServiceContainer services) { _taskList = taskList; _settings = services.GetService <IREditorSettings>(); _idleTime = services.GetService <IIdleTimeService>(); _document = textBuffer.GetEditorDocument <IREditorDocument>(); _document.Closing += OnDocumentClosing; _document.EditorTree.UpdateCompleted += OnTreeUpdateCompleted; _document.EditorTree.NodesRemoved += OnNodesRemoved; _errorTags = new ErrorTagCollection(_document.EditorTree); _textBuffer = _document.EditorTree.TextBuffer(); _textBuffer.Changed += OnTextBufferChanged; // 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 && !_document.IsRepl) { _taskList.AddTaskSource(this); } var validator = _document.EditorBuffer.GetService <TreeValidator>(); validator.Cleared += OnCleared; _resultsQueue = validator.ValidationResults; _idleTime.Idle += OnIdle; }
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); }
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; }