mirror of
https://github.com/microsoft/vscode.git
synced 2026-02-26 20:54:27 +00:00
add precondition to exec'ish cell commands
This commit is contained in:
@@ -21,7 +21,7 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { IQuickInputService, IQuickPickItem, QuickPickInput } from 'vs/platform/quickinput/common/quickInput';
|
||||
import { CATEGORIES } from 'vs/workbench/common/actions';
|
||||
import { BaseCellRenderTemplate, CellEditState, CellFocusMode, EXECUTE_CELL_COMMAND_ID, EXPAND_CELL_CONTENT_COMMAND_ID, IActiveNotebookEditor, ICellViewModel, INotebookEditor, NOTEBOOK_CELL_EDITABLE, NOTEBOOK_CELL_EDITOR_FOCUSED, NOTEBOOK_CELL_HAS_OUTPUTS, NOTEBOOK_CELL_INPUT_COLLAPSED, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CELL_OUTPUT_COLLAPSED, NOTEBOOK_CELL_TYPE, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_RUNNABLE, NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_OUTPUT_FOCUSED } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { BaseCellRenderTemplate, CellEditState, CellFocusMode, EXECUTE_CELL_COMMAND_ID, EXPAND_CELL_CONTENT_COMMAND_ID, IActiveNotebookEditor, ICellViewModel, INotebookEditor, NOTEBOOK_CELL_EDITABLE, NOTEBOOK_CELL_EDITOR_FOCUSED, NOTEBOOK_CELL_HAS_OUTPUTS, NOTEBOOK_CELL_INPUT_COLLAPSED, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_MARKDOWN_EDIT_MODE, NOTEBOOK_CELL_OUTPUT_COLLAPSED, NOTEBOOK_CELL_TYPE, NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_EDITOR_EXECUTING_NOTEBOOK, NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_EDITOR_RUNNABLE, NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_KERNEL_COUNT, NOTEBOOK_OUTPUT_FOCUSED } from 'vs/workbench/contrib/notebook/browser/notebookBrowser';
|
||||
import { CellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/notebookViewModel';
|
||||
import { CellEditType, CellKind, ICellEditOperation, ICellRange, INotebookDocumentFilter, isDocumentExcludePattern, NotebookCellMetadata, NotebookCellRunState, NOTEBOOK_EDITOR_CURSOR_BEGIN_END, NOTEBOOK_EDITOR_CURSOR_BOUNDARY, TransientMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { INotebookService } from 'vs/workbench/contrib/notebook/common/notebookService';
|
||||
@@ -228,10 +228,11 @@ export function getWidgetFromUri(accessor: ServicesAccessor, uri: URI) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
registerAction2(class extends NotebookCellAction<ICellRange> {
|
||||
registerAction2(class ExecuteCell extends NotebookCellAction<ICellRange> {
|
||||
constructor() {
|
||||
super({
|
||||
id: EXECUTE_CELL_COMMAND_ID,
|
||||
precondition: ContextKeyExpr.greater(NOTEBOOK_KERNEL_COUNT.key, 0),
|
||||
title: localize('notebookActions.execute', "Execute Cell"),
|
||||
keybinding: {
|
||||
when: NOTEBOOK_CELL_LIST_FOCUSED,
|
||||
@@ -312,7 +313,7 @@ registerAction2(class extends NotebookCellAction<ICellRange> {
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends NotebookCellAction<ICellRange> {
|
||||
registerAction2(class StopExecuteCell extends NotebookCellAction<ICellRange> {
|
||||
constructor() {
|
||||
super({
|
||||
id: CANCEL_CELL_COMMAND_ID,
|
||||
@@ -442,10 +443,11 @@ export class DeleteCellAction extends MenuItemAction {
|
||||
}
|
||||
}
|
||||
|
||||
registerAction2(class extends NotebookCellAction {
|
||||
registerAction2(class ExecuteCellSelectBelow extends NotebookCellAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: EXECUTE_CELL_SELECT_BELOW,
|
||||
precondition: ContextKeyExpr.greater(NOTEBOOK_KERNEL_COUNT.key, 0),
|
||||
title: localize('notebookActions.executeAndSelectBelow', "Execute Notebook Cell and Select Below"),
|
||||
keybinding: {
|
||||
when: NOTEBOOK_CELL_LIST_FOCUSED,
|
||||
@@ -478,10 +480,11 @@ registerAction2(class extends NotebookCellAction {
|
||||
}
|
||||
});
|
||||
|
||||
registerAction2(class extends NotebookCellAction {
|
||||
registerAction2(class ExecuteCellInsertBelow extends NotebookCellAction {
|
||||
constructor() {
|
||||
super({
|
||||
id: EXECUTE_CELL_INSERT_BELOW,
|
||||
precondition: ContextKeyExpr.greater(NOTEBOOK_KERNEL_COUNT.key, 0),
|
||||
title: localize('notebookActions.executeAndInsertBelow', "Execute Notebook Cell and Insert Below"),
|
||||
keybinding: {
|
||||
when: NOTEBOOK_CELL_LIST_FOCUSED,
|
||||
|
||||
Reference in New Issue
Block a user