Skip to content

Commit

Permalink
Port keybinding updates to release (#6268)
Browse files Browse the repository at this point in the history
* Contribute shift+enter, ctrl+enter, L, shift+L (#6205)

* Ctrl+Enter should put cell into command mode after executing (#6231)

* Update CHANGELOG and remove news
  • Loading branch information
joyceerhl authored Jun 14, 2021
1 parent f12a2fe commit 3f84cf5
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 41 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@

1. On remote connections check for new or removed LiveKernelConnections on document open.
([#5984](https://github.com/Microsoft/vscode-jupyter/issues/5984))
1. When editing a markdown cell in preview native notebooks UI, contribute `ctrl+enter` keybinding to render current markdown cell, and `shift+enter` to render current markdown cell and skip to the next cell.
([#5976](https://github.com/Microsoft/vscode-jupyter/issues/5976))
1. In preview native notebooks UI, contribute `L` keybinding to toggle line numbers for the current cell, and `shift+L` keybinding to toggle line numbers for all cells.
([#4438](https://github.com/Microsoft/vscode-jupyter/issues/4438))
1. Contribute extension-level `shift+enter` keybinding to execute current code cell and select below in preview native notebooks UI.
([#6037](https://github.com/Microsoft/vscode-jupyter/issues/6037))
1. In preview native notebooks interface, contribute `ctrl+enter` keybinding which puts the current cell into control mode instead of leaving it in edit mode after running.
([#6198](https://github.com/Microsoft/vscode-jupyter/issues/6198))

## 2021.6.99 (8 June 2021)

Expand Down
77 changes: 37 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,112 +98,99 @@
"when": "editorTextFocus && !editorHasSelection && jupyter.hascodecells && !notebookEditorFocused"
},
{
"mac": "F",
"win": "F",
"linux": "F",
"key": "F",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.find"
},
{
"mac": "K",
"win": "K",
"linux": "K",
"key": "K",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "list.focusUp"
},
{
"mac": "J",
"win": "J",
"linux": "J",
"key": "J",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "list.focusDown"
},
{
"mac": "A",
"win": "A",
"linux": "A",
"key": "A",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.insertCodeCellAbove"
},
{
"mac": "B",
"win": "B",
"linux": "B",
"key": "B",
"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 && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.delete"
},
{
"mac": "Z",
"win": "Z",
"linux": "Z",
"key": "Z",
"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 && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "jupyter.notebookeditor.keybind.save"
},
{
"mac": "C",
"win": "C",
"linux": "C",
"key": "C",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.copy"
},
{
"mac": "X",
"win": "X",
"linux": "X",
"key": "X",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.cut"
},
{
"mac": "V",
"win": "V",
"linux": "V",
"key": "V",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.paste"
},
{
"mac": "O",
"win": "O",
"linux": "O",
"key": "O",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "jupyter.notebookeditor.keybind.toggleOutput"
},
{
"mac": "ctrl+shift+-",
"win": "ctrl+shift+-",
"linux": "ctrl+shift+-",
"key": "shift+L",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.toggleLineNumbers"
},
{
"key": "L",
"when": "notebookEditorFocused && !inputFocus && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.toggleLineNumbers"
},
{
"key": "ctrl+shift+-",
"when": "editorTextFocus && inputFocus && notebookEditorFocused && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.split"
},
{
"key": "ctrl+enter",
"when": "editorTextFocus && inputFocus && notebookEditorFocused && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts",
"command": "notebook.cell.execute"
"command": "jupyter.notebookeditor.keybind.executeCell"
},
{
"key": "ctrl+enter",
"when": "inputFocus && notebookEditorFocused && !editorHasMultipleSelections && !editorHasSelection && !editorHoverVisible && notebookCellType == 'markup'",
"command": "notebook.cell.quitEdit"
},
{
"key": "shift+enter",
"when": "editorTextFocus && inputFocus && notebookEditorFocused && notebookType == jupyter-notebook && config.jupyter.enableKeyboardShortcuts || notebookCellListFocused && notebookCellType == 'markup' || notebookCellListFocused && notebookCellType == 'code' && notebookCellExecutionState == 'failed' || notebookCellExecutionState == 'idle' || notebookCellExecutionState == 'succeeded' && notebookKernelCount > 0",
"command": "notebook.cell.executeAndSelectBelow"
},
{
"key": "shift+enter",
"when": "inputFocus && notebookEditorFocused && !editorHasMultipleSelections && !editorHasSelection && !editorHoverVisible && notebookCellType == 'markup'",
"command": "jupyter.notebookeditor.keybind.renderMarkdownAndSelectBelow"
},
{
"command": "jupyter.insertCellBelowPosition",
Expand Down Expand Up @@ -385,6 +372,11 @@
"title": "%DataScience.toggleCellOutput%",
"category": "Notebook"
},
{
"command": "jupyter.notebookeditor.keybind.renderMarkdownAndSelectBelow",
"title": "%DataScience.renderMarkdownAndSelectBelow%",
"category": "Notebook"
},
{
"command": "jupyter.selectCell",
"title": "%jupyter.command.jupyter.selectCell.title%",
Expand Down Expand Up @@ -894,6 +886,11 @@
"title": "%DataScience.toggleCellOutput%",
"when": "notebookType == jupyter-notebook"
},
{
"command": "jupyter.notebookeditor.keybind.renderMarkdownAndSelectBelow",
"title": "%DataScience.renderMarkdownAndSelectBelow%",
"when": "false"
},
{
"command": "jupyter.exportAsPythonScript",
"title": "%jupyter.command.jupyter.exportAsPythonScript.title%",
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@
"DataScience.addCell": "Add cell",
"DataScience.runAll": "Run all cells",
"DataScience.toggleCellOutput": "Toggle Cell Output",
"DataScience.renderMarkdownAndSelectBelow": "Execute Notebook Cell and Select Below",
"DataScience.convertingToPythonFile": "Converting ipynb to python file",
"DataScience.untitledNotebookMessage": "Your changes will be lost if you don't save them.",
"DataScience.untitledNotebookYes": "Save",
Expand Down
4 changes: 4 additions & 0 deletions src/client/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ interface ICommandNameWithoutArgumentTypeMapping {
[DSCommands.ResetLoggingLevel]: [];
[DSCommands.OpenVariableView]: [];
[DSCommands.NotebookEditorToggleOutput]: [];
[DSCommands.NotebookEditorKeybindExecuteCell]: [];
[DSCommands.NotebookEditorKeybindRenderMarkdownAndSelectBelow]: [];
['notebook.cell.quitEdit']: [];
['notebook.cell.executeAndSelectBelow']: [];
['notebook.cell.collapseCellOutput']: [];
['notebook.cell.expandCellOutput']: [];
}
Expand Down
20 changes: 19 additions & 1 deletion src/client/datascience/commands/notebookCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ export class NotebookCommands implements IDisposable {
this.commandManager.registerCommand(Commands.NotebookEditorExpandAllCells, this.expandAll, this),
this.commandManager.registerCommand(Commands.NotebookEditorKeybindSave, this.keybindSave, this),
this.commandManager.registerCommand(Commands.NotebookEditorKeybindUndo, this.keybindUndo, this),
this.commandManager.registerCommand(Commands.NotebookEditorToggleOutput, this.toggleOutput, this)
this.commandManager.registerCommand(Commands.NotebookEditorToggleOutput, this.toggleOutput, this),
this.commandManager.registerCommand(Commands.NotebookEditorKeybindExecuteCell, this.executeCell, this),
this.commandManager.registerCommand(
Commands.NotebookEditorKeybindRenderMarkdownAndSelectBelow,
this.renderMarkdownAndSelectBelow,
this
)
);
}
public dispose() {
Expand All @@ -51,6 +57,18 @@ export class NotebookCommands implements IDisposable {
}
}

private executeCell() {
void this.commandManager
.executeCommand('notebook.cell.execute')
.then(() => this.commandManager.executeCommand('notebook.cell.quitEdit'));
}

private renderMarkdownAndSelectBelow() {
void this.commandManager
.executeCommand('notebook.cell.quitEdit')
.then(() => this.commandManager.executeCommand('notebook.cell.executeAndSelectBelow'));
}

private collapseAll() {
if (this.notebookEditorProvider.activeEditor) {
this.notebookEditorProvider.activeEditor.collapseAllCells();
Expand Down
3 changes: 3 additions & 0 deletions src/client/datascience/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ export namespace Commands {
export const OpenVariableView = 'jupyter.openVariableView';
export const NotebookEditorKeybindSave = 'jupyter.notebookeditor.keybind.save';
export const NotebookEditorKeybindUndo = 'jupyter.notebookeditor.keybind.undo';
export const NotebookEditorKeybindRenderMarkdownAndSelectBelow =
'jupyter.notebookeditor.keybind.renderMarkdownAndSelectBelow';
export const NotebookEditorKeybindExecuteCell = 'jupyter.notebookeditor.keybind.executeCell';
export const NotebookEditorToggleOutput = 'jupyter.notebookeditor.keybind.toggleOutput';
}

Expand Down

0 comments on commit 3f84cf5

Please sign in to comment.