Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…to dev/joyceerhl/remove-run-above-below
  • Loading branch information
joyceerhl committed Jun 3, 2021
2 parents a4835fa + 3b30f83 commit 93e74ca
Show file tree
Hide file tree
Showing 16 changed files with 277 additions and 317 deletions.
66 changes: 33 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,107 +102,107 @@
"win": "F",
"linux": "F",
"key": "F",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.find"
},
{
"mac": "K",
"win": "K",
"linux": "K",
"key": "K",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "list.focusUp"
},
{
"mac": "J",
"win": "J",
"linux": "J",
"key": "J",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "list.focusDown"
},
{
"mac": "A",
"win": "A",
"linux": "A",
"key": "A",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.insertCodeCellAbove"
},
{
"mac": "B",
"win": "B",
"linux": "B",
"key": "B",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.insertCodeCellBelow"
},
{
"mac": "D D",
"win": "D D",
"linux": "D D",
"key": "D D",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.delete"
},
{
"mac": "Z",
"win": "Z",
"linux": "Z",
"key": "Z",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "jupyter.notebookeditor.keybind.undo"
},
{
"mac": "S",
"win": "S",
"linux": "S",
"key": "S",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "jupyter.notebookeditor.keybind.save"
},
{
"mac": "C",
"win": "C",
"linux": "C",
"key": "C",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.copy"
},
{
"mac": "X",
"win": "X",
"linux": "X",
"key": "X",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.cut"
},
{
"mac": "V",
"win": "V",
"linux": "V",
"key": "V",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.paste"
},
{
"mac": "O",
"win": "O",
"linux": "O",
"key": "O",
"when": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "jupyter.notebookeditor.keybind.toggleOutput"
},
{
"mac": "ctrl+shift+-",
"win": "ctrl+shift+-",
"linux": "ctrl+shift+-",
"when": "editorTextFocus && inputFocus && notebookEditorFocused && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "editorTextFocus && inputFocus && notebookEditorFocused && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.split"
},
{
"key": "ctrl+enter",
"when": "editorTextFocus && inputFocus && notebookEditorFocused && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"when": "editorTextFocus && inputFocus && notebookEditorFocused && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.execute"
},
{
Expand Down Expand Up @@ -297,7 +297,7 @@
"light": "resources/light/export_to_python.svg",
"dark": "resources/dark/export_to_python.svg"
},
"enablement": "notebookViewType == jupyter-notebook && isWorkspaceTrusted"
"enablement": "notebookType == jupyter-notebook && isWorkspaceTrusted"
},
{
"command": "jupyter.export",
Expand Down Expand Up @@ -602,13 +602,13 @@
"command": "jupyter.notebookeditor.keybind.undo",
"title": "%jupyter.command.jupyter.notebookeditor.keybind.undo.title%",
"category": "Notebook",
"enablement": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts"
"enablement": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts"
},
{
"command": "jupyter.notebookeditor.keybind.save",
"title": "%jupyter.command.jupyter.notebookeditor.keybind.save.title%",
"category": "Notebook",
"enablement": "notebookEditorFocused && !inputFocus && notebookViewType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts"
"enablement": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts"
},
{
"command": "jupyter.removeallcells",
Expand Down Expand Up @@ -636,7 +636,7 @@
"light": "resources/light/interrupt.svg",
"dark": "resources/dark/interrupt.svg"
},
"enablement": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canInterruptNotebookKernel"
"enablement": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canInterruptNotebookKernel"
},
{
"command": "jupyter.notebookeditor.restartkernel",
Expand Down Expand Up @@ -750,7 +750,7 @@
"shortTitle": "%jupyter.command.jupyter.openVariableView.shorttitle%",
"icon": "$(variable-group)",
"category": "Jupyter",
"enablement": "notebookViewType == jupyter-notebook && !jupyter.variableViewVisible && isWorkspaceTrusted"
"enablement": "notebookType == jupyter-notebook && !jupyter.variableViewVisible && isWorkspaceTrusted"
},
{
"command": "jupyter.refreshDataViewer",
Expand Down Expand Up @@ -817,53 +817,53 @@
"command": "jupyter.notebookeditor.restartkernel",
"title": "%jupyter.command.jupyter.restartkernel.title%",
"group": "navigation@1",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canrestartNotebookkernel"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canrestartNotebookkernel"
},
{
"command": "jupyter.notebookeditor.interruptkernel",
"title": "%jupyter.command.jupyter.interruptkernel.title%",
"group": "overflow@1",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canInterruptNotebookKernel"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted && jupyter.notebookeditor.canInterruptNotebookKernel"
},
{
"command": "jupyter.openVariableView",
"title": "%jupyter.command.jupyter.openVariableView.title%",
"group": "navigation@2",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
},
{
"command": "jupyter.notebookeditor.export",
"title": "%DataScience.notebookExportAs%",
"group": "navigation@3",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
},
{
"command": "jupyter.selectNativeJupyterUriFromToolBar",
"title": "%jupyter.command.jupyter.selectjupyteruri.title%",
"group": "overflow@1000",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
}
],
"notebook/toolbar": [
{
"command": "jupyter.notebookeditor.restartkernel",
"group": "navigation/execute@1",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
},
{
"command": "jupyter.notebookeditor.interruptkernel",
"group": "navigation/execute@2",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
},
{
"command": "jupyter.openVariableView",
"group": "navigation@1",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
},
{
"command": "jupyter.notebookeditor.export",
"group": "navigation@2",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
}
],
"explorer/context": [
Expand Down Expand Up @@ -892,7 +892,7 @@
{
"command": "jupyter.notebookeditor.keybind.toggleOutput",
"title": "%DataScience.toggleCellOutput%",
"when": "notebookViewType == jupyter-notebook"
"when": "notebookType == jupyter-notebook"
},
{
"command": "jupyter.exportAsPythonScript",
Expand Down Expand Up @@ -1149,7 +1149,7 @@
"command": "jupyter.notebookeditor.interruptkernel",
"title": "%jupyter.command.jupyter.interruptkernel.title%",
"category": "Notebook",
"when": "notebookViewType == 'jupyter-notebook' && isWorkspaceTrusted"
"when": "notebookType == 'jupyter-notebook' && isWorkspaceTrusted"
},
{
"command": "jupyter.notebookeditor.restartkernel",
Expand All @@ -1167,13 +1167,13 @@
"command": "jupyter.notebookeditor.expandallcells",
"title": "%jupyter.command.jupyter.expandallcells.title%",
"category": "Notebook",
"when": "notebookEditorFocused && notebookViewType == 'jupyter-notebook'"
"when": "notebookEditorFocused && notebookType == 'jupyter-notebook'"
},
{
"command": "jupyter.notebookeditor.collapseallcells",
"title": "%jupyter.command.jupyter.collapseallcells.title%",
"category": "Notebook",
"when": "notebookEditorFocused && notebookViewType == 'jupyter-notebook'"
"when": "notebookEditorFocused && notebookType == 'jupyter-notebook'"
},
{
"command": "jupyter.notebookeditor.keybind.undo",
Expand Down Expand Up @@ -1321,7 +1321,7 @@
"command": "jupyter.openVariableView",
"title": "%jupyter.command.jupyter.openVariableView.title%",
"category": "Jupyter",
"when": "notebookViewType == jupyter-notebook && isWorkspaceTrusted"
"when": "notebookType == jupyter-notebook && isWorkspaceTrusted"
},
{
"command": "jupyter.selectNativeJupyterUriFromToolBar",
Expand Down
11 changes: 6 additions & 5 deletions src/client/common/application/notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
NotebookEditorSelectionChangeEvent,
NotebookExecuteHandler,
NotebookRendererScript,
window
window,
workspace
} from 'vscode';
import { UseVSCodeNotebookEditorApi } from '../constants';
import { IDisposableRegistry } from '../types';
Expand All @@ -31,7 +32,7 @@ export class VSCodeNotebook implements IVSCodeNotebook {
public readonly onDidSaveNotebookDocument: Event<NotebookDocument>;
public readonly onDidChangeNotebookDocument: Event<NotebookCellChangedEvent>;
public get notebookDocuments(): ReadonlyArray<NotebookDocument> {
return this.canUseNotebookApi ? notebooks.notebookDocuments : [];
return this.canUseNotebookApi ? workspace.notebookDocuments : [];
}
public get notebookEditors() {
return this.canUseNotebookApi ? window.visibleNotebookEditors : [];
Expand Down Expand Up @@ -60,8 +61,8 @@ export class VSCodeNotebook implements IVSCodeNotebook {
this.canUseNotebookApi = true;
this.onDidChangeNotebookEditorSelection = window.onDidChangeNotebookEditorSelection;
this.onDidChangeActiveNotebookEditor = window.onDidChangeActiveNotebookEditor;
this.onDidOpenNotebookDocument = notebooks.onDidOpenNotebookDocument;
this.onDidCloseNotebookDocument = notebooks.onDidCloseNotebookDocument;
this.onDidOpenNotebookDocument = workspace.onDidOpenNotebookDocument;
this.onDidCloseNotebookDocument = workspace.onDidCloseNotebookDocument;
this.onDidChangeVisibleNotebookEditors = window.onDidChangeVisibleNotebookEditors;
this.onDidSaveNotebookDocument = notebooks.onDidSaveNotebookDocument;
this.onDidChangeNotebookDocument = this._onDidChangeNotebookDocument.event;
Expand All @@ -86,7 +87,7 @@ export class VSCodeNotebook implements IVSCodeNotebook {
transientDocumentMetadata?: { [x: string]: boolean | undefined } | undefined;
}
): Disposable {
return notebooks.registerNotebookContentProvider(notebookType, provider, options);
return workspace.registerNotebookContentProvider(notebookType, provider, options);
}
public createNotebookController(
id: string,
Expand Down
Loading

0 comments on commit 93e74ca

Please sign in to comment.