Closed takahashim closed 3 years ago
起動直後に「縦書きプレビュー」や「プレビューサーバー起動」を実行しようとすると、たまにエラーになることがありました。
あれこれ試してみたところ、テキストにカーソルがない状態で実行しようとすると vscode.window.activeTextEditor がnullになり、[error] TypeError: Cannot read property 'document' of undefined というエラーが発生するようでした。
vscode.window.activeTextEditor
[error] TypeError: Cannot read property 'document' of undefined
これはactiveTextEditorの存在チェックを入れて、nullのときは無視して何もしないようにすると治るようです。
activeTextEditor
ありがとうございます。マージします。
originEditor変数を使って制御しようとしていたのですが、こちらの方が良いですね。 採用します。
起動直後に「縦書きプレビュー」や「プレビューサーバー起動」を実行しようとすると、たまにエラーになることがありました。
あれこれ試してみたところ、テキストにカーソルがない状態で実行しようとすると
vscode.window.activeTextEditor
がnullになり、[error] TypeError: Cannot read property 'document' of undefined
というエラーが発生するようでした。これは
activeTextEditor
の存在チェックを入れて、nullのときは無視して何もしないようにすると治るようです。