public ReflectTextChange ( int start, int oldLength, int newLength, bool trivialChange ) : void | ||
start | int | |
oldLength | int | |
newLength | int | |
trivialChange | bool | |
return | void |
private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e) { if (REditorSettings.SyntaxCheck && e.Changes.Count > 0) { var changes = TextUtility.ConvertToRelative(e); foreach (var change in changes) { _errorTags.ReflectTextChange(change.Start, change.OldLength, change.NewLength, trivialChange: !_document.EditorTree.IsReady); } if ((_errorTags.RemovedTags.Count > 0) && (TagsChanged != null)) { int start = Int32.MaxValue; int end = Int32.MinValue; foreach (var errorTag in _errorTags.RemovedTags) { start = Math.Min(start, errorTag.Start); end = Math.Max(end, errorTag.End); } // RemovedTags haven't had their positions updated, verify their // values won't break the SnapshotSpan creation ITextSnapshot snapshot = _textBuffer.CurrentSnapshot; start = Math.Min(start, snapshot.Length); end = Math.Min(end, snapshot.Length); TagsChanged(this, new SnapshotSpanEventArgs( new SnapshotSpan(snapshot, start, end - start))); } TasksUpdated?.Invoke(this, EventArgs.Empty); } }
private void OnTextBufferChanged(object sender, TextContentChangedEventArgs e) { if (_settings.SyntaxCheckEnabled && e.Changes.Count > 0) { var change = e.ToTextChange(); _errorTags.ReflectTextChange(change.Start, change.OldLength, change.NewLength, trivialChange: !_document.EditorTree.IsReady); if (_errorTags.RemovedTags.Count > 0 && TagsChanged != null) { var start = int.MaxValue; var end = int.MinValue; foreach (var errorTag in _errorTags.RemovedTags) { start = Math.Min(start, errorTag.Start); end = Math.Max(end, errorTag.End); } // RemovedTags haven't had their positions updated, verify their // values won't break the SnapshotSpan creation var snapshot = _textBuffer.CurrentSnapshot; start = Math.Min(start, snapshot.Length); end = Math.Min(end, snapshot.Length); TagsChanged(this, new SnapshotSpanEventArgs( new SnapshotSpan(snapshot, start, end - start))); } TasksUpdated?.Invoke(this, EventArgs.Empty); } }