ファイルを開いたときにTextEditorを取得する
VSCodeのエクスプローラでファイルを開いたとき、そのファイルのTextEditorを取得するには、onDidChangeActiveTextEditorを使います。
context.subscriptions.push(
if (!event || (event.document.languageId !== "poyonshotmdcat")) {
return;
}
})
);
引数のeventは、undefinedの場合があるのでチェックしてから、event.documentでファイルの種類を調べられます。