async function openFile(uri) { const options = { preview: false, viewColumn: vscode.ViewColumn.One, }; const workspaceFolder = getWorkspaceUri(); const docURI = vscode.Uri.joinPath(workspaceFolder, uri.path); const files = await vscode.workspace.textDocuments.filter(doc => doc.fileName === docURI.fsPath); if (files.length === 0) { // no active file, open it and return //const doc = await vscode.workspace.openTextDocument(docURI); console.log("open", docURI); await vscode.commands.executeCommand("vscode.openWith", vscode.Uri.file(docURI.fsPath), 'jupyter-notebook'); // indow.showTextDocument(doc, options); return; } // if we have the window open and it is not active just show it for await (const doc of files) { if (vscode.window.activeTextEditor?.document.fileName !== doc.fileName) { await vscode.commands.executeCommand("vscode.openWith", vscode.Uri.file(docURI.fsPath), 'jupyter-notebook'); } } }