Skip to content

Commit

Permalink
Fix restart when the notebook editor is not active. (#11828)
Browse files Browse the repository at this point in the history
Skip ipykernel check on restart to avoiding needing an editor.
Fix #11789
  • Loading branch information
roblourens authored Oct 27, 2022
1 parent 4306ec6 commit 809d3c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/notebooks/debugger/controllers/restartController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class RestartController implements IDebuggingDelegate {
.disconnect()
.then(() => {
this.trace('restart', 'doRestart');
return this.debuggingManager.tryToStartDebugging(this.mode, this.debugCell);
return this.debuggingManager.tryToStartDebugging(this.mode, this.debugCell, true);
})
.catch((err) => {
this.error('restart', `Error restarting: ${err}`);
Expand Down
15 changes: 10 additions & 5 deletions src/notebooks/debugger/debuggingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,20 @@ export class DebuggingManager
this.debugDocuments.set(Array.from(debugDocumentUris.values())).ignoreErrors();
}

public async tryToStartDebugging(mode: KernelDebugMode, cell: NotebookCell) {
public async tryToStartDebugging(mode: KernelDebugMode, cell: NotebookCell, skipIpykernelCheck = false) {
traceInfo(`Starting debugging with mode ${mode}`);

const ipykernelResult = await this.checkIpykernelAndPrompt(cell);
if (ipykernelResult === IpykernelCheckResult.Ok) {
if (mode === KernelDebugMode.RunByLine || mode === KernelDebugMode.Cell) {
await this.startDebuggingCell(mode, cell!);
if (!skipIpykernelCheck) {
const ipykernelResult = await this.checkIpykernelAndPrompt(cell);
if (ipykernelResult !== IpykernelCheckResult.Ok) {
traceInfo(`Ipykernel check failed: ${IpykernelCheckResult[ipykernelResult]}`);
return;
}
}

if (mode === KernelDebugMode.RunByLine || mode === KernelDebugMode.Cell) {
await this.startDebuggingCell(mode, cell!);
}
}

public runByLineNext(cell: NotebookCell) {
Expand Down
2 changes: 1 addition & 1 deletion src/notebooks/debugger/debuggingTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export interface IDebuggingManager {

export const INotebookDebuggingManager = Symbol('INotebookDebuggingManager');
export interface INotebookDebuggingManager extends IDebuggingManager {
tryToStartDebugging(mode: KernelDebugMode, cell: NotebookCell): Promise<void>;
tryToStartDebugging(mode: KernelDebugMode, cell: NotebookCell, skipIpykernelCheck?: boolean): Promise<void>;
runByLineNext(cell: NotebookCell): void;
runByLineStop(cell: NotebookCell): void;
}
Expand Down

0 comments on commit 809d3c0

Please sign in to comment.