4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import { KeyCode , KeyMod } from 'vs/base/common/keyCodes' ;
7
+ import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions' ;
7
8
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys' ;
8
9
import { localize } from 'vs/nls' ;
9
10
import { registerAction2 } from 'vs/platform/actions/common/actions' ;
@@ -14,10 +15,9 @@ import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation
14
15
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry' ;
15
16
import { Registry } from 'vs/platform/registry/common/platform' ;
16
17
import { INotebookActionContext , INotebookCellActionContext , NotebookAction , NotebookCellAction , NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from 'vs/workbench/contrib/notebook/browser/controller/coreActions' ;
17
- import { NOTEBOOK_CELL_HAS_OUTPUTS , NOTEBOOK_CELL_MARKDOWN_EDIT_MODE , NOTEBOOK_CELL_TYPE , NOTEBOOK_CURSOR_NAVIGATION_MODE , NOTEBOOK_EDITOR_FOCUSED , NOTEBOOK_OUTPUT_FOCUSED } from 'vs/workbench/contrib/notebook/common/notebookContextKeys' ;
18
18
import { CellEditState } from 'vs/workbench/contrib/notebook/browser/notebookBrowser' ;
19
19
import { CellKind , NOTEBOOK_EDITOR_CURSOR_BOUNDARY } from 'vs/workbench/contrib/notebook/common/notebookCommon' ;
20
- import { EditorExtensionsRegistry } from 'vs/editor/browser/editorExtensions ' ;
20
+ import { NOTEBOOK_CELL_HAS_OUTPUTS , NOTEBOOK_CELL_MARKDOWN_EDIT_MODE , NOTEBOOK_CELL_TYPE , NOTEBOOK_CURSOR_NAVIGATION_MODE , NOTEBOOK_EDITOR_FOCUSED , NOTEBOOK_OUTPUT_FOCUSED } from 'vs/workbench/contrib/notebook/common/notebookContextKeys ' ;
21
21
22
22
const NOTEBOOK_FOCUS_TOP = 'notebook.focusTop' ;
23
23
const NOTEBOOK_FOCUS_BOTTOM = 'notebook.focusBottom' ;
@@ -42,22 +42,27 @@ registerAction2(class FocusNextCellAction extends NotebookCellAction {
42
42
when : ContextKeyExpr . and (
43
43
NOTEBOOK_EDITOR_FOCUSED ,
44
44
ContextKeyExpr . equals ( 'config.notebook.navigation.allowNavigateToSurroundingCells' , true ) ,
45
- ContextKeyExpr . or (
46
- ContextKeyExpr . and (
47
- ContextKeyExpr . has ( InputFocusedContextKey ) ,
48
- EditorContextKeys . editorTextFocus ,
49
- NOTEBOOK_EDITOR_CURSOR_BOUNDARY . notEqualsTo ( 'top' ) ,
50
- NOTEBOOK_EDITOR_CURSOR_BOUNDARY . notEqualsTo ( 'none' ) ,
51
- ) ,
52
- ContextKeyExpr . and (
53
- NOTEBOOK_CELL_TYPE . isEqualTo ( 'markup' ) ,
54
- NOTEBOOK_CELL_MARKDOWN_EDIT_MODE . isEqualTo ( false ) ,
55
- NOTEBOOK_CURSOR_NAVIGATION_MODE
56
- )
57
- )
45
+ ContextKeyExpr . and (
46
+ ContextKeyExpr . has ( InputFocusedContextKey ) ,
47
+ EditorContextKeys . editorTextFocus ,
48
+ NOTEBOOK_EDITOR_CURSOR_BOUNDARY . notEqualsTo ( 'top' ) ,
49
+ NOTEBOOK_EDITOR_CURSOR_BOUNDARY . notEqualsTo ( 'none' ) ,
50
+ ) ,
58
51
) ,
59
52
primary : KeyCode . DownArrow ,
60
- weight : KeybindingWeight . WorkbenchContrib ,
53
+ weight : NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT , // code cell keybinding, focus inside editor: lower weight to not override suggest widget
54
+ } ,
55
+ {
56
+ when : ContextKeyExpr . and (
57
+ NOTEBOOK_EDITOR_FOCUSED ,
58
+ ContextKeyExpr . equals ( 'config.notebook.navigation.allowNavigateToSurroundingCells' , true ) ,
59
+ ContextKeyExpr . and (
60
+ NOTEBOOK_CELL_TYPE . isEqualTo ( 'markup' ) ,
61
+ NOTEBOOK_CELL_MARKDOWN_EDIT_MODE . isEqualTo ( false ) ,
62
+ NOTEBOOK_CURSOR_NAVIGATION_MODE )
63
+ ) ,
64
+ primary : KeyCode . DownArrow ,
65
+ weight : KeybindingWeight . WorkbenchContrib , // markdown keybinding, focus on list: higher weight to override list.focusDown
61
66
} ,
62
67
{
63
68
when : ContextKeyExpr . and ( NOTEBOOK_EDITOR_FOCUSED , NOTEBOOK_OUTPUT_FOCUSED ) ,
@@ -95,27 +100,35 @@ registerAction2(class FocusPreviousCellAction extends NotebookCellAction {
95
100
super ( {
96
101
id : NOTEBOOK_FOCUS_PREVIOUS_EDITOR ,
97
102
title : localize ( 'cursorMoveUp' , 'Focus Previous Cell Editor' ) ,
98
- keybinding : {
99
- when : ContextKeyExpr . and (
100
- NOTEBOOK_EDITOR_FOCUSED ,
101
- ContextKeyExpr . equals ( 'config.notebook.navigation.allowNavigateToSurroundingCells' , true ) ,
102
- ContextKeyExpr . or (
103
+ keybinding : [
104
+ {
105
+ when : ContextKeyExpr . and (
106
+ NOTEBOOK_EDITOR_FOCUSED ,
107
+ ContextKeyExpr . equals ( 'config.notebook.navigation.allowNavigateToSurroundingCells' , true ) ,
103
108
ContextKeyExpr . and (
104
109
ContextKeyExpr . has ( InputFocusedContextKey ) ,
105
110
EditorContextKeys . editorTextFocus ,
106
111
NOTEBOOK_EDITOR_CURSOR_BOUNDARY . notEqualsTo ( 'bottom' ) ,
107
112
NOTEBOOK_EDITOR_CURSOR_BOUNDARY . notEqualsTo ( 'none' ) ,
108
113
) ,
114
+ ) ,
115
+ primary : KeyCode . UpArrow ,
116
+ weight : NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT , // code cell keybinding, focus inside editor: lower weight to not override suggest widget
117
+ } ,
118
+ {
119
+ when : ContextKeyExpr . and (
120
+ NOTEBOOK_EDITOR_FOCUSED ,
121
+ ContextKeyExpr . equals ( 'config.notebook.navigation.allowNavigateToSurroundingCells' , true ) ,
109
122
ContextKeyExpr . and (
110
123
NOTEBOOK_CELL_TYPE . isEqualTo ( 'markup' ) ,
111
124
NOTEBOOK_CELL_MARKDOWN_EDIT_MODE . isEqualTo ( false ) ,
112
125
NOTEBOOK_CURSOR_NAVIGATION_MODE
113
126
)
114
- )
115
- ) ,
116
- primary : KeyCode . UpArrow ,
117
- weight : KeybindingWeight . WorkbenchContrib ,
118
- } ,
127
+ ) ,
128
+ primary : KeyCode . UpArrow ,
129
+ weight : KeybindingWeight . WorkbenchContrib , // markdown keybinding, focus on list: higher weight to override list.focusDown
130
+ }
131
+ ] ,
119
132
} ) ;
120
133
}
121
134
0 commit comments