コード例 #1
0
        protected virtual void OnTextChanged(TextChangeEventArgs e)
        {
            var handler = TextChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #2
0
 private void OnTextChanged(TextChangeEventArgs textChangeEventArgs)
 {
     if (TextChanged != null)
     {
         if (textChangeEventArgs != null)
         {
             if (CurrentText != null)
             {
                 TextChanged(this, new TextChangeEventArgs(_oldText, newText: CurrentText, changes: textChangeEventArgs.Changes));
             }
         }
     }
 }
コード例 #3
0
            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);
                }
            }
コード例 #4
0
            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);
            }
コード例 #5
0
 protected virtual void OnTextChanged(TextChangeEventArgs e)
 {
     var handler = TextChanged;
     if (handler != null) handler(this, e);
 }
コード例 #6
0
 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);
 }
コード例 #7
0
            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);
                }
            }