Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start notebook sessions in the notebook's parent directory #2917

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/jupyter-adapter/src/JupyterKernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(<vscode.TerminalOptions>{
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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} `
Expand Down
Loading