mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 17:23:40 -05:00
Restart kernel initial implementation (#18835)
* Restart kernel initial implementation * Update notebook extension TestKernel * PR comments
This commit is contained in:
@@ -239,6 +239,24 @@ CommandsRegistry.registerCommand({
|
||||
}
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand({
|
||||
id: 'notebook.restartKernel',
|
||||
handler: async (accessor: ServicesAccessor) => {
|
||||
const editorService: IEditorService = accessor.get(IEditorService);
|
||||
if (editorService.activeEditor instanceof NotebookInput) {
|
||||
await editorService.activeEditor.notebookModel?.clientSession?.restart();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
||||
command: {
|
||||
id: 'notebook.restartKernel',
|
||||
title: localize('restartNotebookKernel', "Restart Notebook Kernel"),
|
||||
},
|
||||
when: ContextKeyExpr.and(ActiveEditorContext.isEqualTo(NotebookEditor.ID))
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
|
||||
command: {
|
||||
id: TOGGLE_TAB_FOCUS_COMMAND_ID,
|
||||
|
||||
@@ -168,6 +168,10 @@ class EmptyKernel implements nb.IKernel {
|
||||
interrupt(): Thenable<void> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
restart(): Thenable<void> {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
}
|
||||
|
||||
export class EmptyFuture implements FutureInternal {
|
||||
|
||||
@@ -353,7 +353,7 @@ export class ClientSessionStub implements IClientSession {
|
||||
selectKernel(): Promise<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
restart(): Promise<boolean> {
|
||||
restart(): Promise<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
setPath(path: string): Promise<void> {
|
||||
@@ -464,6 +464,9 @@ export class KernelStub implements nb.IKernel {
|
||||
interrupt(): Thenable<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
restart(): Thenable<void> {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
}
|
||||
|
||||
export class FutureStub implements nb.IFuture {
|
||||
|
||||
Reference in New Issue
Block a user