提交 f5b1ca4d 编写于 作者: J Johannes Rieken

notebook - more (and shared) category label, more nls

上级 7205cd17
...@@ -58,7 +58,7 @@ const EXECUTE_CELL_INSERT_BELOW = 'notebook.cell.executeAndInsertBelow'; ...@@ -58,7 +58,7 @@ const EXECUTE_CELL_INSERT_BELOW = 'notebook.cell.executeAndInsertBelow';
const CLEAR_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.clearOutputs'; const CLEAR_CELL_OUTPUTS_COMMAND_ID = 'notebook.cell.clearOutputs';
const NOTEBOOK_ACTIONS_CATEGORY = localize('notebookActions.category', "Notebook"); export const NOTEBOOK_ACTIONS_CATEGORY = localize('notebookActions.category', "Notebook");
const EDITOR_WIDGET_ACTION_WEIGHT = KeybindingWeight.EditorContrib; // smaller than Suggest Widget, etc const EDITOR_WIDGET_ACTION_WEIGHT = KeybindingWeight.EditorContrib; // smaller than Suggest Widget, etc
...@@ -168,6 +168,7 @@ registerAction2(class extends Action2 { ...@@ -168,6 +168,7 @@ registerAction2(class extends Action2 {
super({ super({
id: EXECUTE_CELL_SELECT_BELOW, id: EXECUTE_CELL_SELECT_BELOW,
title: localize('notebookActions.executeAndSelectBelow', "Execute Notebook Cell and Select Below"), title: localize('notebookActions.executeAndSelectBelow', "Execute Notebook Cell and Select Below"),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: NOTEBOOK_EDITOR_FOCUSED, when: NOTEBOOK_EDITOR_FOCUSED,
primary: KeyMod.Shift | KeyCode.Enter, primary: KeyMod.Shift | KeyCode.Enter,
...@@ -211,6 +212,7 @@ registerAction2(class extends Action2 { ...@@ -211,6 +212,7 @@ registerAction2(class extends Action2 {
super({ super({
id: EXECUTE_CELL_INSERT_BELOW, id: EXECUTE_CELL_INSERT_BELOW,
title: localize('notebookActions.executeAndInsertBelow', "Execute Notebook Cell and Insert Below"), title: localize('notebookActions.executeAndInsertBelow', "Execute Notebook Cell and Insert Below"),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: NOTEBOOK_EDITOR_FOCUSED, when: NOTEBOOK_EDITOR_FOCUSED,
primary: KeyMod.Alt | KeyCode.Enter, primary: KeyMod.Alt | KeyCode.Enter,
...@@ -285,6 +287,7 @@ registerAction2(class extends Action2 { ...@@ -285,6 +287,7 @@ registerAction2(class extends Action2 {
super({ super({
id: QUIT_EDIT_CELL_COMMAND_ID, id: QUIT_EDIT_CELL_COMMAND_ID,
title: localize('notebookActions.quitEditing', "Quit Notebook Cell Editing"), title: localize('notebookActions.quitEditing', "Quit Notebook Cell Editing"),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, InputFocusedContext), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, InputFocusedContext),
primary: KeyCode.Escape, primary: KeyCode.Escape,
...@@ -316,6 +319,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, { ...@@ -316,6 +319,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: { command: {
id: EXECUTE_NOTEBOOK_COMMAND_ID, id: EXECUTE_NOTEBOOK_COMMAND_ID,
title: localize('notebookActions.menu.executeNotebook', "Execute Notebook (Run all cells)"), title: localize('notebookActions.menu.executeNotebook', "Execute Notebook (Run all cells)"),
category: NOTEBOOK_ACTIONS_CATEGORY,
icon: { id: 'codicon/run-all' } icon: { id: 'codicon/run-all' }
}, },
order: -1, order: -1,
...@@ -327,6 +331,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, { ...@@ -327,6 +331,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: { command: {
id: CANCEL_NOTEBOOK_COMMAND_ID, id: CANCEL_NOTEBOOK_COMMAND_ID,
title: localize('notebookActions.menu.cancelNotebook', "Stop Notebook Execution"), title: localize('notebookActions.menu.cancelNotebook', "Stop Notebook Execution"),
category: NOTEBOOK_ACTIONS_CATEGORY,
icon: { id: 'codicon/primitive-square' } icon: { id: 'codicon/primitive-square' }
}, },
order: -1, order: -1,
...@@ -339,6 +344,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, { ...@@ -339,6 +344,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
command: { command: {
id: EXECUTE_CELL_COMMAND_ID, id: EXECUTE_CELL_COMMAND_ID,
title: localize('notebookActions.menu.execute', "Execute Notebook Cell"), title: localize('notebookActions.menu.execute', "Execute Notebook Cell"),
category: NOTEBOOK_ACTIONS_CATEGORY,
icon: { id: 'codicon/run' } icon: { id: 'codicon/run' }
}, },
order: 0, order: 0,
...@@ -983,7 +989,8 @@ registerAction2(class extends Action2 { ...@@ -983,7 +989,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: NOTEBOOK_CURSOR_DOWN, id: NOTEBOOK_CURSOR_DOWN,
title: 'Notebook Cursor Move Down', title: localize('cursorMoveDown', 'Cursor Move Down'),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.has(InputFocusedContextKey), EditorContextKeys.editorTextFocus, NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top'), NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.has(InputFocusedContextKey), EditorContextKeys.editorTextFocus, NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('top'), NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')),
primary: KeyCode.DownArrow, primary: KeyCode.DownArrow,
...@@ -1022,7 +1029,8 @@ registerAction2(class extends Action2 { ...@@ -1022,7 +1029,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: NOTEBOOK_CURSOR_UP, id: NOTEBOOK_CURSOR_UP,
title: 'Notebook Cursor Move Up', title: localize('cursorMoveUp', 'Cursor Move Up'),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.has(InputFocusedContextKey), EditorContextKeys.editorTextFocus, NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('bottom'), NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.has(InputFocusedContextKey), EditorContextKeys.editorTextFocus, NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('bottom'), NOTEBOOK_EDITOR_CURSOR_BOUNDARY.notEqualsTo('none')),
primary: KeyCode.UpArrow, primary: KeyCode.UpArrow,
...@@ -1066,7 +1074,8 @@ registerAction2(class extends Action2 { ...@@ -1066,7 +1074,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: NOTEBOOK_UNDO, id: NOTEBOOK_UNDO,
title: 'Notebook Undo', title: localize('undo', 'Undo'),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyMod.CtrlCmd | KeyCode.KEY_Z, primary: KeyMod.CtrlCmd | KeyCode.KEY_Z,
...@@ -1097,7 +1106,8 @@ registerAction2(class extends Action2 { ...@@ -1097,7 +1106,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: NOTEBOOK_REDO, id: NOTEBOOK_REDO,
title: 'Notebook Redo', title: localize('redo', 'Redo'),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z, primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_Z,
...@@ -1128,7 +1138,8 @@ registerAction2(class extends Action2 { ...@@ -1128,7 +1138,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: NOTEBOOK_FOCUS_TOP, id: NOTEBOOK_FOCUS_TOP,
title: 'Notebook Focus First Cell', title: localize('focusFirstCell', 'Focus First Cell'),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyMod.CtrlCmd | KeyCode.Home, primary: KeyMod.CtrlCmd | KeyCode.Home,
...@@ -1161,7 +1172,8 @@ registerAction2(class extends Action2 { ...@@ -1161,7 +1172,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: NOTEBOOK_FOCUS_BOTTOM, id: NOTEBOOK_FOCUS_BOTTOM,
title: 'Notebook Focus Last Cell', title: localize('focusLastCell', 'Focus Last Cell'),
category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyMod.CtrlCmd | KeyCode.End, primary: KeyMod.CtrlCmd | KeyCode.End,
...@@ -1194,7 +1206,8 @@ registerAction2(class extends Action2 { ...@@ -1194,7 +1206,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: CLEAR_CELL_OUTPUTS_COMMAND_ID, id: CLEAR_CELL_OUTPUTS_COMMAND_ID,
title: 'Notebook Clear Active Cell Outputs', title: localize('clearActiveCellOutputs', 'Clear Active Cell Outputs'),
category: NOTEBOOK_ACTIONS_CATEGORY,
menu: { menu: {
id: MenuId.NotebookCellTitle, id: MenuId.NotebookCellTitle,
when: ContextKeyExpr.and(NOTEBOOK_CELL_TYPE.isEqualTo('code'), NOTEBOOK_EDITOR_RUNNABLE), when: ContextKeyExpr.and(NOTEBOOK_CELL_TYPE.isEqualTo('code'), NOTEBOOK_EDITOR_RUNNABLE),
...@@ -1226,7 +1239,8 @@ registerAction2(class extends Action2 { ...@@ -1226,7 +1239,8 @@ registerAction2(class extends Action2 {
constructor() { constructor() {
super({ super({
id: CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID, id: CLEAR_ALL_CELLS_OUTPUTS_COMMAND_ID,
title: 'Notebook Clear All Cells Outputs', title: localize('clearAllCellsOutputs', 'Clear All Cells Outputs'),
category: NOTEBOOK_ACTIONS_CATEGORY,
menu: { menu: {
id: MenuId.EditorTitle, id: MenuId.EditorTitle,
when: NOTEBOOK_EDITOR_FOCUSED, when: NOTEBOOK_EDITOR_FOCUSED,
...@@ -1254,4 +1268,3 @@ registerAction2(class extends Action2 { ...@@ -1254,4 +1268,3 @@ registerAction2(class extends Action2 {
editor.viewModel.notebookDocument.clearAllCellOutputs(); editor.viewModel.notebookDocument.clearAllCellOutputs();
} }
}); });
...@@ -16,7 +16,7 @@ import { KeyCode } from 'vs/base/common/keyCodes'; ...@@ -16,7 +16,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { getActiveNotebookEditor } from 'vs/workbench/contrib/notebook/browser/contrib/coreActions'; import { getActiveNotebookEditor, NOTEBOOK_ACTIONS_CATEGORY } from 'vs/workbench/contrib/notebook/browser/contrib/coreActions';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
export class FoldingController extends Disposable implements INotebookEditorContribution { export class FoldingController extends Disposable implements INotebookEditorContribution {
...@@ -135,7 +135,7 @@ registerAction2(class extends Action2 { ...@@ -135,7 +135,7 @@ registerAction2(class extends Action2 {
super({ super({
id: 'notebook.fold', id: 'notebook.fold',
title: localize('fold.cell', 'Fold Cell'), title: localize('fold.cell', 'Fold Cell'),
category: localize('cat', "Notebook"), category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyCode.LeftArrow, primary: KeyCode.LeftArrow,
...@@ -173,7 +173,7 @@ registerAction2(class extends Action2 { ...@@ -173,7 +173,7 @@ registerAction2(class extends Action2 {
super({ super({
id: 'notebook.unfold', id: 'notebook.unfold',
title: localize('unfold.cell', 'Unfold Cell'), title: localize('unfold.cell', 'Unfold Cell'),
category: localize('cat', "Notebook"), category: NOTEBOOK_ACTIONS_CATEGORY,
keybinding: { keybinding: {
when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)),
primary: KeyCode.RightArrow, primary: KeyCode.RightArrow,
......
...@@ -10,7 +10,7 @@ import { NOTEBOOK_IS_ACTIVE_EDITOR } from 'vs/workbench/contrib/notebook/browser ...@@ -10,7 +10,7 @@ import { NOTEBOOK_IS_ACTIVE_EDITOR } from 'vs/workbench/contrib/notebook/browser
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { getActiveNotebookEditor } from 'vs/workbench/contrib/notebook/browser/contrib/coreActions'; import { getActiveNotebookEditor, NOTEBOOK_ACTIONS_CATEGORY } from 'vs/workbench/contrib/notebook/browser/contrib/coreActions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ITextModelService } from 'vs/editor/common/services/resolverService'; import { ITextModelService } from 'vs/editor/common/services/resolverService';
import { DisposableStore } from 'vs/base/common/lifecycle'; import { DisposableStore } from 'vs/base/common/lifecycle';
...@@ -26,7 +26,7 @@ registerAction2(class extends Action2 { ...@@ -26,7 +26,7 @@ registerAction2(class extends Action2 {
super({ super({
id: 'notebook.format', id: 'notebook.format',
title: localize('format.title', 'Format Notebook'), title: localize('format.title', 'Format Notebook'),
category: localize('cat', "Notebook"), category: NOTEBOOK_ACTIONS_CATEGORY,
precondition: ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR), precondition: ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR),
keybinding: { keybinding: {
when: EditorContextKeys.editorTextFocus.toNegated(), when: EditorContextKeys.editorTextFocus.toNegated(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册