protected virtual void OnTextChanged(TextChangeEventArgs e) { var handler = TextChanged; if (handler != null) { handler(this, e); } }
private void OnTextChanged(TextChangeEventArgs textChangeEventArgs) { if (TextChanged != null) { if (textChangeEventArgs != null) { if (CurrentText != null) { TextChanged(this, new TextChangeEventArgs(_oldText, newText: CurrentText, changes: textChangeEventArgs.Changes)); } } } }
private void OnTextContentChanged(object sender, TextContentChangedEventArgs args) { var changed = this.EtextChanged; if (changed != null && args.Changes.Count != 0) { // this should convert given editor snapshots to roslyn forked snapshots var oldText = (SnapshotSourceText)args.Before.AsText(); var newText = SnapshotSourceText.From(args.After); _currentText = newText; var changes = ImmutableArray.CreateRange(args.Changes.Select(c => new TextChangeRange(new TextSpan(c.OldSpan.Start, c.OldSpan.Length), c.NewLength))); var eventArgs = new TextChangeEventArgs(oldText, newText, changes); this.LastEventArgs = eventArgs; changed(sender, eventArgs); } }
private void OnTextContentChanged(object sender, TextContentChangedEventArgs args) { var changed = this.EtextChanged; if (changed == null) { return; } // we should process all changes even though there is no text changes // otherwise, Workspace.CurrentSolution won't move forward to latest ITextSnapshot // this should convert given editor snapshots to roslyn forked snapshots var oldText = (SnapshotSourceText)args.Before.AsText(); var newText = SnapshotSourceText.From(_textBufferCloneServiceOpt, args.After); _currentText = newText; var changes = ImmutableArray.CreateRange(args.Changes.Select(c => new TextChangeRange(new TextSpan(c.OldSpan.Start, c.OldSpan.Length), c.NewLength))); var eventArgs = new TextChangeEventArgs(oldText, newText, changes); this.LastEventArgs = eventArgs; changed(sender, eventArgs); }
protected virtual void OnTextChanged(TextChangeEventArgs e) { var handler = TextChanged; if (handler != null) handler(this, e); }
private void OnTextChanged(object sender, TextChangeEventArgs e) { // ok, the version changed. Report that we've got an edit so that we can analyze // this source file and update anything accordingly. this.workspace.OnDocumentTextChanged(this.documentId, e.NewText, mode: PreservationMode.PreserveIdentity); }