ファイルを開いたときにTextEditorを取得する

VSCodeエクスプローラでファイルを開いたとき、そのファイルのTextEditorを取得するには、onDidChangeActiveTextEditorを使います。

    context.subscriptions.push(  
        vscode.window.onDidChangeActiveTextEditor( (event) => {
            if (!event || (event.document.languageId !== "poyonshotmdcat")) {
                return;
            }
        })
    );

引数のeventは、undefinedの場合があるのでチェックしてから、event.documentでファイルの種類を調べられます。