From 68525cd71f67ffdc0befa40c5eb4efa9fa657a48 Mon Sep 17 00:00:00 2001 From: Jonathan McPherson Date: Fri, 26 Apr 2024 17:06:06 -0700 Subject: [PATCH 1/2] use notebook's base directory as working directory --- extensions/jupyter-adapter/src/JupyterKernel.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extensions/jupyter-adapter/src/JupyterKernel.ts b/extensions/jupyter-adapter/src/JupyterKernel.ts index ca1a373b7f4..85f67e6cb12 100644 --- a/extensions/jupyter-adapter/src/JupyterKernel.ts +++ b/extensions/jupyter-adapter/src/JupyterKernel.ts @@ -709,6 +709,8 @@ export class JupyterKernel extends EventEmitter implements vscode.Disposable { // Use the VS Code terminal API to create a terminal for the kernel this._terminal = vscode.window.createTerminal({ name: this._spec.display_name, + // Always start notebook sessions in the directory of the notebook + cwd: this._notebookUri ? path.dirname(this._notebookUri.path) : undefined, shellPath: shellPath, shellArgs: shellArgs, env, From 7376acc58c2d31796a6d1c980113fd546c1050f9 Mon Sep 17 00:00:00 2001 From: Jonathan McPherson Date: Fri, 26 Apr 2024 17:06:21 -0700 Subject: [PATCH 2/2] derive notebook session name from file name --- .../src/notebookSessionService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions/positron-notebook-controllers/src/notebookSessionService.ts b/extensions/positron-notebook-controllers/src/notebookSessionService.ts index 552113186f0..9f2cec6e8bf 100644 --- a/extensions/positron-notebook-controllers/src/notebookSessionService.ts +++ b/extensions/positron-notebook-controllers/src/notebookSessionService.ts @@ -4,6 +4,7 @@ import * as positron from 'positron'; import * as vscode from 'vscode'; +import * as path from 'path'; import { log } from './extension'; import { ResourceMap } from './map'; @@ -192,7 +193,7 @@ export class NotebookSessionService implements vscode.Disposable { try { const session = await positron.runtime.startLanguageRuntime( preferredRuntime.runtimeId, - notebookUri.path, // Use the notebook's path as the session name. + path.basename(notebookUri.path), // Use the notebook's file name as the session name. notebookUri); log.info( `Starting session for language runtime ${session.metadata.sessionId} `