拡張機能のコードエディタでコードを追加/削除するにはどうすればよいですか?例えばVisual Studioの現在のエディタウィンドウにコードを追加するパッケージ/拡張子
:
私は拡張魔法使いが使用してみました例では、Microsoft.VisualStudio.Text.Editor
を使用
着信ソケットからコードを変更作成:
IWpfTextView textView; // got from visual studio "Create" event ITextChange change; // Got from network socket or other source
ITextEdit edit = textView.TextBuffer.CreateEdit(); // Throws "Not Owner" Exception edit.Delete(change.OldSpan); edit.Insert(change.NewPosition, change.NewText);
しかしCrateEdit()関数が失敗するため、別の方法があると思います。
を把握コードはありますか? – JaredPar
エラー:間違ったスレッドでTextBufferを編集しようとしました。 "textView.TextBuffer.TakeThreadOwnership();" throws: TextBufferの編集スレッドを変更しようとしました。 –