@codingame/monaco-vscode-keybindings-service-override 5.3.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +13 -8
- package/vscode/src/vs/workbench/browser/contextkeys.js +41 -81
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +5 -4
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/preferences/common/smartSnippetInserter.js +11 -11
- package/vscode/src/vs/workbench/services/commands/common/commandService.js +1 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +51 -49
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +5 -4
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +175 -178
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +70 -68
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-keybindings-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
30
|
-
"@codingame/monaco-vscode-files-service-override": "
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@6.0.1",
|
|
30
|
+
"@codingame/monaco-vscode-files-service-override": "6.0.1"
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
|
-
import { OS } from 'vscode/vscode/vs/base/common/platform';
|
|
3
|
-
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
2
|
+
import { OS, OperatingSystem } from 'vscode/vscode/vs/base/common/platform';
|
|
3
|
+
import { Extensions, ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
4
4
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
5
5
|
|
|
6
6
|
const _moduleId = "vs/platform/keyboardLayout/common/keyboardConfig";
|
|
7
|
+
var DispatchConfig;
|
|
8
|
+
( ((function(DispatchConfig) {
|
|
9
|
+
DispatchConfig[DispatchConfig["Code"] = 0] = "Code";
|
|
10
|
+
DispatchConfig[DispatchConfig["KeyCode"] = 1] = "KeyCode";
|
|
11
|
+
})(DispatchConfig || (DispatchConfig = {}))));
|
|
7
12
|
function readKeyboardConfig(configurationService) {
|
|
8
13
|
const keyboard = configurationService.getValue('keyboard');
|
|
9
|
-
const dispatch = (
|
|
14
|
+
const dispatch = (keyboard?.dispatch === 'keyCode' ? DispatchConfig.KeyCode : DispatchConfig.Code);
|
|
10
15
|
const mapAltGrToCtrlAlt = Boolean(keyboard?.mapAltGrToCtrlAlt);
|
|
11
16
|
return { dispatch, mapAltGrToCtrlAlt };
|
|
12
17
|
}
|
|
@@ -18,7 +23,7 @@ const keyboardConfiguration = {
|
|
|
18
23
|
'title': ( localizeWithPath(_moduleId, 0, "Keyboard")),
|
|
19
24
|
'properties': {
|
|
20
25
|
'keyboard.dispatch': {
|
|
21
|
-
scope:
|
|
26
|
+
scope: ConfigurationScope.APPLICATION,
|
|
22
27
|
type: 'string',
|
|
23
28
|
enum: ['code', 'keyCode'],
|
|
24
29
|
default: 'code',
|
|
@@ -27,10 +32,10 @@ const keyboardConfiguration = {
|
|
|
27
32
|
1,
|
|
28
33
|
"Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
|
|
29
34
|
)),
|
|
30
|
-
included: OS ===
|
|
35
|
+
included: OS === OperatingSystem.Macintosh || OS === OperatingSystem.Linux
|
|
31
36
|
},
|
|
32
37
|
'keyboard.mapAltGrToCtrlAlt': {
|
|
33
|
-
scope:
|
|
38
|
+
scope: ConfigurationScope.APPLICATION,
|
|
34
39
|
type: 'boolean',
|
|
35
40
|
default: false,
|
|
36
41
|
markdownDescription: ( localizeWithPath(
|
|
@@ -38,10 +43,10 @@ const keyboardConfiguration = {
|
|
|
38
43
|
2,
|
|
39
44
|
"Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."
|
|
40
45
|
)),
|
|
41
|
-
included: OS ===
|
|
46
|
+
included: OS === OperatingSystem.Windows
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
};
|
|
45
50
|
configurationRegistry.registerConfiguration(keyboardConfiguration);
|
|
46
51
|
|
|
47
|
-
export { readKeyboardConfig };
|
|
52
|
+
export { DispatchConfig, readKeyboardConfig };
|
|
@@ -4,48 +4,41 @@ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
|
4
4
|
import { setConstant } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
5
|
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
6
6
|
import { IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsIOSContext, IsMobileContext, IsDevelopmentContext, ProductQualityContext, InputFocusedContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
7
|
-
import { RemoteNameContext, VirtualWorkspaceContext, TemporaryWorkspaceContext, HasWebFileSystemAccess, EmbedderIdentifierContext,
|
|
8
|
-
import { TEXT_DIFF_EDITOR_ID, SIDE_BY_SIDE_EDITOR_ID, EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
7
|
+
import { RemoteNameContext, VirtualWorkspaceContext, TemporaryWorkspaceContext, HasWebFileSystemAccess, EmbedderIdentifierContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, EditorsVisibleContext, DirtyWorkingCopiesContext, WorkbenchStateContext, WorkspaceFolderCountContext, OpenFolderWorkspaceSupportContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, SplitEditorsVertically, IsMainWindowFullscreenContext, IsAuxiliaryWindowFocusedContext, InEditorZenModeContext, IsMainEditorCenteredLayoutContext, MainEditorAreaVisibleContext, EditorTabsVisibleContext, SideBarVisibleContext, TitleBarVisibleContext, TitleBarStyleContext, PanelPositionContext, PanelVisibleContext, PanelMaximizedContext, PanelAlignmentContext, AuxiliaryBarVisibleContext } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
9
8
|
import { onDidRegisterWindow, addDisposableListener, EventType, trackFocus, getActiveWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
10
|
-
import { preferredSideBySideGroupDirection } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
9
|
+
import { preferredSideBySideGroupDirection, GroupDirection } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
11
10
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
12
11
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
13
12
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
14
|
-
import {
|
|
15
|
-
import { isTemporaryWorkspace } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
13
|
+
import { WorkbenchState, isTemporaryWorkspace } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
16
14
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
17
|
-
import { positionToString } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
15
|
+
import { positionToString, Parts } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService';
|
|
18
16
|
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
19
17
|
import { getRemoteName } from 'vscode/vscode/vs/platform/remote/common/remoteHosts';
|
|
20
18
|
import { getVirtualWorkspaceScheme } from 'vscode/vscode/vs/platform/workspace/common/virtualWorkspace';
|
|
21
19
|
import { IWorkingCopyService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyService.service';
|
|
22
20
|
import { isNative } from 'vscode/vscode/vs/base/common/platform';
|
|
23
|
-
import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService.service';
|
|
24
21
|
import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite.service';
|
|
25
22
|
import { WebFileSystemAccess } from 'vscode/vscode/vs/platform/files/browser/webFileSystemAccess';
|
|
26
23
|
import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
|
|
27
|
-
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
28
24
|
import { getTitleBarStyle } from 'vscode/vscode/vs/platform/window/common/window';
|
|
29
25
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
30
|
-
import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
31
26
|
import { onDidChangeFullscreen, isFullscreen } from 'vscode/vscode/vs/base/browser/browser';
|
|
32
|
-
import {
|
|
27
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
33
28
|
|
|
34
29
|
let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disposable {
|
|
35
|
-
constructor(contextKeyService, contextService, configurationService, environmentService, productService,
|
|
30
|
+
constructor(contextKeyService, contextService, configurationService, environmentService, productService, editorGroupService, editorService, layoutService, paneCompositeService, workingCopyService) {
|
|
36
31
|
super();
|
|
37
32
|
this.contextKeyService = contextKeyService;
|
|
38
33
|
this.contextService = contextService;
|
|
39
34
|
this.configurationService = configurationService;
|
|
40
35
|
this.environmentService = environmentService;
|
|
41
36
|
this.productService = productService;
|
|
42
|
-
this.editorService = editorService;
|
|
43
|
-
this.editorResolverService = editorResolverService;
|
|
44
37
|
this.editorGroupService = editorGroupService;
|
|
38
|
+
this.editorService = editorService;
|
|
45
39
|
this.layoutService = layoutService;
|
|
46
40
|
this.paneCompositeService = paneCompositeService;
|
|
47
41
|
this.workingCopyService = workingCopyService;
|
|
48
|
-
this.fileService = fileService;
|
|
49
42
|
IsMacContext.bindTo(this.contextKeyService);
|
|
50
43
|
IsLinuxContext.bindTo(this.contextKeyService);
|
|
51
44
|
IsWindowsContext.bindTo(this.contextKeyService);
|
|
@@ -63,22 +56,12 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
63
56
|
setConstant(IsDevelopmentContext.key, isDevelopment);
|
|
64
57
|
ProductQualityContext.bindTo(this.contextKeyService).set(this.productService.quality || '');
|
|
65
58
|
EmbedderIdentifierContext.bindTo(this.contextKeyService).set(productService.embedderIdentifier);
|
|
66
|
-
this.activeEditorContext = ActiveEditorContext.bindTo(this.contextKeyService);
|
|
67
|
-
this.activeEditorIsReadonly = ActiveEditorReadonlyContext.bindTo(this.contextKeyService);
|
|
68
|
-
this.activeCompareEditorCanSwap = ActiveCompareEditorCanSwapContext.bindTo(this.contextKeyService);
|
|
69
|
-
this.activeEditorCanToggleReadonly = ActiveEditorCanToggleReadonlyContext.bindTo(this.contextKeyService);
|
|
70
|
-
this.activeEditorCanRevert = ActiveEditorCanRevertContext.bindTo(this.contextKeyService);
|
|
71
|
-
this.activeEditorCanSplitInGroup = ActiveEditorCanSplitInGroupContext.bindTo(this.contextKeyService);
|
|
72
|
-
this.activeEditorAvailableEditorIds = ActiveEditorAvailableEditorIdsContext.bindTo(this.contextKeyService);
|
|
73
|
-
this.editorsVisibleContext = EditorsVisibleContext.bindTo(this.contextKeyService);
|
|
74
|
-
this.textCompareEditorVisibleContext = TextCompareEditorVisibleContext.bindTo(this.contextKeyService);
|
|
75
|
-
this.textCompareEditorActiveContext = TextCompareEditorActiveContext.bindTo(this.contextKeyService);
|
|
76
|
-
this.sideBySideEditorActiveContext = SideBySideEditorActiveContext.bindTo(this.contextKeyService);
|
|
77
59
|
this.activeEditorGroupEmpty = ActiveEditorGroupEmptyContext.bindTo(this.contextKeyService);
|
|
78
60
|
this.activeEditorGroupIndex = ActiveEditorGroupIndexContext.bindTo(this.contextKeyService);
|
|
79
61
|
this.activeEditorGroupLast = ActiveEditorGroupLastContext.bindTo(this.contextKeyService);
|
|
80
62
|
this.activeEditorGroupLocked = ActiveEditorGroupLockedContext.bindTo(this.contextKeyService);
|
|
81
63
|
this.multipleEditorGroupsContext = MultipleEditorGroupsContext.bindTo(this.contextKeyService);
|
|
64
|
+
this.editorsVisibleContext = EditorsVisibleContext.bindTo(this.contextKeyService);
|
|
82
65
|
this.dirtyWorkingCopiesContext = DirtyWorkingCopiesContext.bindTo(this.contextKeyService);
|
|
83
66
|
this.dirtyWorkingCopiesContext.set(this.workingCopyService.hasDirty);
|
|
84
67
|
this.inputFocusedContext = InputFocusedContext.bindTo(this.contextKeyService);
|
|
@@ -107,27 +90,28 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
107
90
|
this.panelPositionContext = PanelPositionContext.bindTo(this.contextKeyService);
|
|
108
91
|
this.panelPositionContext.set(positionToString(this.layoutService.getPanelPosition()));
|
|
109
92
|
this.panelVisibleContext = PanelVisibleContext.bindTo(this.contextKeyService);
|
|
110
|
-
this.panelVisibleContext.set(this.layoutService.isVisible(
|
|
93
|
+
this.panelVisibleContext.set(this.layoutService.isVisible(Parts.PANEL_PART));
|
|
111
94
|
this.panelMaximizedContext = PanelMaximizedContext.bindTo(this.contextKeyService);
|
|
112
95
|
this.panelMaximizedContext.set(this.layoutService.isPanelMaximized());
|
|
113
96
|
this.panelAlignmentContext = PanelAlignmentContext.bindTo(this.contextKeyService);
|
|
114
97
|
this.panelAlignmentContext.set(this.layoutService.getPanelAlignment());
|
|
115
98
|
this.auxiliaryBarVisibleContext = AuxiliaryBarVisibleContext.bindTo(this.contextKeyService);
|
|
116
|
-
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(
|
|
99
|
+
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART));
|
|
117
100
|
this.registerListeners();
|
|
118
101
|
}
|
|
119
102
|
registerListeners() {
|
|
120
103
|
this.editorGroupService.whenReady.then(() => {
|
|
121
104
|
this.updateEditorAreaContextKeys();
|
|
122
|
-
this.
|
|
105
|
+
this.updateEditorGroupContextKeys();
|
|
106
|
+
this.updateVisiblePanesContextKeys();
|
|
123
107
|
});
|
|
124
|
-
this._register(this.editorService.onDidActiveEditorChange(() => this.
|
|
125
|
-
this._register(this.editorService.onDidVisibleEditorsChange(() => this.
|
|
126
|
-
this._register(this.editorGroupService.onDidAddGroup(() => this.
|
|
127
|
-
this._register(this.editorGroupService.onDidRemoveGroup(() => this.
|
|
128
|
-
this._register(this.editorGroupService.onDidChangeGroupIndex(() => this.
|
|
129
|
-
this._register(this.editorGroupService.onDidChangeActiveGroup(() => this.
|
|
130
|
-
this._register(this.editorGroupService.onDidChangeGroupLocked(() => this.
|
|
108
|
+
this._register(this.editorService.onDidActiveEditorChange(() => this.updateEditorGroupContextKeys()));
|
|
109
|
+
this._register(this.editorService.onDidVisibleEditorsChange(() => this.updateVisiblePanesContextKeys()));
|
|
110
|
+
this._register(this.editorGroupService.onDidAddGroup(() => this.updateEditorGroupContextKeys()));
|
|
111
|
+
this._register(this.editorGroupService.onDidRemoveGroup(() => this.updateEditorGroupContextKeys()));
|
|
112
|
+
this._register(this.editorGroupService.onDidChangeGroupIndex(() => this.updateEditorGroupContextKeys()));
|
|
113
|
+
this._register(this.editorGroupService.onDidChangeActiveGroup(() => this.updateEditorGroupsContextKeys()));
|
|
114
|
+
this._register(this.editorGroupService.onDidChangeGroupLocked(() => this.updateEditorGroupsContextKeys()));
|
|
131
115
|
this._register(this.editorGroupService.onDidChangeEditorPartOptions(() => this.updateEditorAreaContextKeys()));
|
|
132
116
|
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => disposables.add(addDisposableListener(window, EventType.FOCUS_IN, () => this.updateInputContextKeys(window.document), true)), { window: mainWindow, disposables: this._store }));
|
|
133
117
|
this._register(this.contextService.onDidChangeWorkbenchState(() => this.updateWorkbenchStateContextKey()));
|
|
@@ -153,58 +137,33 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
153
137
|
this._register(this.paneCompositeService.onDidPaneCompositeClose(() => this.updateSideBarContextKeys()));
|
|
154
138
|
this._register(this.paneCompositeService.onDidPaneCompositeOpen(() => this.updateSideBarContextKeys()));
|
|
155
139
|
this._register(this.layoutService.onDidChangePartVisibility(() => {
|
|
156
|
-
this.mainEditorAreaVisibleContext.set(this.layoutService.isVisible(
|
|
157
|
-
this.panelVisibleContext.set(this.layoutService.isVisible(
|
|
140
|
+
this.mainEditorAreaVisibleContext.set(this.layoutService.isVisible(Parts.EDITOR_PART, mainWindow));
|
|
141
|
+
this.panelVisibleContext.set(this.layoutService.isVisible(Parts.PANEL_PART));
|
|
158
142
|
this.panelMaximizedContext.set(this.layoutService.isPanelMaximized());
|
|
159
|
-
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(
|
|
143
|
+
this.auxiliaryBarVisibleContext.set(this.layoutService.isVisible(Parts.AUXILIARYBAR_PART));
|
|
160
144
|
this.updateTitleBarContextKeys();
|
|
161
145
|
}));
|
|
162
146
|
this._register(this.workingCopyService.onDidChangeDirty(workingCopy => this.dirtyWorkingCopiesContext.set(workingCopy.isDirty() || this.workingCopyService.hasDirty)));
|
|
163
147
|
}
|
|
164
|
-
|
|
165
|
-
this.editorTabsVisibleContext.set(this.editorGroupService.partOptions.showTabs === 'multiple');
|
|
166
|
-
}
|
|
167
|
-
updateEditorContextKeys() {
|
|
168
|
-
const activeEditorPane = this.editorService.activeEditorPane;
|
|
148
|
+
updateVisiblePanesContextKeys() {
|
|
169
149
|
const visibleEditorPanes = this.editorService.visibleEditorPanes;
|
|
170
|
-
this.textCompareEditorActiveContext.set(activeEditorPane?.getId() === TEXT_DIFF_EDITOR_ID);
|
|
171
|
-
this.textCompareEditorVisibleContext.set(( visibleEditorPanes.some(editorPane => editorPane.getId() === TEXT_DIFF_EDITOR_ID)));
|
|
172
|
-
this.sideBySideEditorActiveContext.set(activeEditorPane?.getId() === SIDE_BY_SIDE_EDITOR_ID);
|
|
173
150
|
if (visibleEditorPanes.length > 0) {
|
|
174
151
|
this.editorsVisibleContext.set(true);
|
|
175
152
|
}
|
|
176
153
|
else {
|
|
177
154
|
this.editorsVisibleContext.reset();
|
|
178
155
|
}
|
|
156
|
+
}
|
|
157
|
+
updateEditorGroupContextKeys() {
|
|
179
158
|
if (!this.editorService.activeEditor) {
|
|
180
159
|
this.activeEditorGroupEmpty.set(true);
|
|
181
160
|
}
|
|
182
161
|
else {
|
|
183
162
|
this.activeEditorGroupEmpty.reset();
|
|
184
163
|
}
|
|
185
|
-
this.
|
|
186
|
-
if (activeEditorPane) {
|
|
187
|
-
this.activeEditorContext.set(activeEditorPane.getId());
|
|
188
|
-
this.activeEditorCanRevert.set(!activeEditorPane.input.hasCapability(4 ));
|
|
189
|
-
this.activeEditorCanSplitInGroup.set(activeEditorPane.input.hasCapability(32 ));
|
|
190
|
-
applyAvailableEditorIds(this.activeEditorAvailableEditorIds, activeEditorPane.input, this.editorResolverService);
|
|
191
|
-
this.activeEditorIsReadonly.set(!!activeEditorPane.input.isReadonly());
|
|
192
|
-
const primaryEditorResource = EditorResourceAccessor.getOriginalUri(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
193
|
-
const secondaryEditorResource = EditorResourceAccessor.getOriginalUri(activeEditorPane.input, { supportSideBySide: SideBySideEditor.SECONDARY });
|
|
194
|
-
this.activeCompareEditorCanSwap.set(activeEditorPane.input instanceof DiffEditorInput && !activeEditorPane.input.original.isReadonly() && !!primaryEditorResource && (this.fileService.hasProvider(primaryEditorResource) || primaryEditorResource.scheme === Schemas.untitled) && !!secondaryEditorResource && (this.fileService.hasProvider(secondaryEditorResource) || secondaryEditorResource.scheme === Schemas.untitled));
|
|
195
|
-
this.activeEditorCanToggleReadonly.set(!!primaryEditorResource && this.fileService.hasProvider(primaryEditorResource) && !this.fileService.hasCapability(primaryEditorResource, 2048 ));
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
this.activeEditorContext.reset();
|
|
199
|
-
this.activeEditorIsReadonly.reset();
|
|
200
|
-
this.activeCompareEditorCanSwap.reset();
|
|
201
|
-
this.activeEditorCanToggleReadonly.reset();
|
|
202
|
-
this.activeEditorCanRevert.reset();
|
|
203
|
-
this.activeEditorCanSplitInGroup.reset();
|
|
204
|
-
this.activeEditorAvailableEditorIds.reset();
|
|
205
|
-
}
|
|
164
|
+
this.updateEditorGroupsContextKeys();
|
|
206
165
|
}
|
|
207
|
-
|
|
166
|
+
updateEditorGroupsContextKeys() {
|
|
208
167
|
const groupCount = this.editorGroupService.count;
|
|
209
168
|
if (groupCount > 1) {
|
|
210
169
|
this.multipleEditorGroupsContext.set(true);
|
|
@@ -217,6 +176,9 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
217
176
|
this.activeEditorGroupLast.set(activeGroup.index === groupCount - 1);
|
|
218
177
|
this.activeEditorGroupLocked.set(activeGroup.isLocked);
|
|
219
178
|
}
|
|
179
|
+
updateEditorAreaContextKeys() {
|
|
180
|
+
this.editorTabsVisibleContext.set(this.editorGroupService.partOptions.showTabs === 'multiple');
|
|
181
|
+
}
|
|
220
182
|
updateInputContextKeys(ownerDocument) {
|
|
221
183
|
function activeElementIsInput() {
|
|
222
184
|
return !!ownerDocument.activeElement && (ownerDocument.activeElement.tagName === 'INPUT' || ownerDocument.activeElement.tagName === 'TEXTAREA');
|
|
@@ -241,20 +203,20 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
241
203
|
}
|
|
242
204
|
updateSplitEditorsVerticallyContext() {
|
|
243
205
|
const direction = preferredSideBySideGroupDirection(this.configurationService);
|
|
244
|
-
this.splitEditorsVerticallyContext.set(direction ===
|
|
206
|
+
this.splitEditorsVerticallyContext.set(direction === GroupDirection.DOWN);
|
|
245
207
|
}
|
|
246
208
|
getWorkbenchStateString() {
|
|
247
209
|
switch (this.contextService.getWorkbenchState()) {
|
|
248
|
-
case
|
|
249
|
-
case
|
|
250
|
-
case
|
|
210
|
+
case WorkbenchState.EMPTY: return 'empty';
|
|
211
|
+
case WorkbenchState.FOLDER: return 'folder';
|
|
212
|
+
case WorkbenchState.WORKSPACE: return 'workspace';
|
|
251
213
|
}
|
|
252
214
|
}
|
|
253
215
|
updateSideBarContextKeys() {
|
|
254
|
-
this.sideBarVisibleContext.set(this.layoutService.isVisible(
|
|
216
|
+
this.sideBarVisibleContext.set(this.layoutService.isVisible(Parts.SIDEBAR_PART));
|
|
255
217
|
}
|
|
256
218
|
updateTitleBarContextKeys() {
|
|
257
|
-
this.titleAreaVisibleContext.set(this.layoutService.isVisible(
|
|
219
|
+
this.titleAreaVisibleContext.set(this.layoutService.isVisible(Parts.TITLEBAR_PART, mainWindow));
|
|
258
220
|
this.titleBarStyleContext.set(getTitleBarStyle(this.configurationService));
|
|
259
221
|
}
|
|
260
222
|
updateWorkspaceContextKeys() {
|
|
@@ -268,13 +230,11 @@ WorkbenchContextKeysHandler = ( __decorate([
|
|
|
268
230
|
( __param(2, IConfigurationService)),
|
|
269
231
|
( __param(3, IWorkbenchEnvironmentService)),
|
|
270
232
|
( __param(4, IProductService)),
|
|
271
|
-
( __param(5,
|
|
272
|
-
( __param(6,
|
|
273
|
-
( __param(7,
|
|
274
|
-
( __param(8,
|
|
275
|
-
( __param(9,
|
|
276
|
-
( __param(10, IWorkingCopyService)),
|
|
277
|
-
( __param(11, IFileService))
|
|
233
|
+
( __param(5, IEditorGroupsService)),
|
|
234
|
+
( __param(6, IEditorService)),
|
|
235
|
+
( __param(7, IWorkbenchLayoutService)),
|
|
236
|
+
( __param(8, IPaneCompositePartService)),
|
|
237
|
+
( __param(9, IWorkingCopyService))
|
|
278
238
|
], WorkbenchContextKeysHandler));
|
|
279
239
|
|
|
280
240
|
export { WorkbenchContextKeysHandler };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { safeStringify } from 'vscode/vscode/vs/base/common/objects';
|
|
1
2
|
import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
2
3
|
import { Action2, registerAction2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
3
4
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
@@ -82,13 +83,13 @@ class RunCommands extends Action2 {
|
|
|
82
83
|
try {
|
|
83
84
|
for (; i < args.commands.length; ++i) {
|
|
84
85
|
const cmd = args.commands[i];
|
|
85
|
-
logService.debug(`runCommands: executing ${i}-th command: ${
|
|
86
|
-
|
|
87
|
-
logService.debug(`runCommands: executed ${i}-th command
|
|
86
|
+
logService.debug(`runCommands: executing ${i}-th command: ${safeStringify(cmd)}`);
|
|
87
|
+
await this._runCommand(commandService, cmd);
|
|
88
|
+
logService.debug(`runCommands: executed ${i}-th command`);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
catch (err) {
|
|
91
|
-
logService.debug(`runCommands: executing ${i}-th command resulted in an error: ${err instanceof Error ? err.message :
|
|
92
|
+
logService.debug(`runCommands: executing ${i}-th command resulted in an error: ${err instanceof Error ? err.message : safeStringify(err)}`);
|
|
92
93
|
notificationService.error(err);
|
|
93
94
|
}
|
|
94
95
|
}
|
package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/life
|
|
|
6
6
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
7
7
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
8
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
9
|
-
import { registerEditorContribution } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
9
|
+
import { registerEditorContribution, EditorContributionInstantiation } from 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
10
10
|
import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
|
|
11
11
|
import { SmartSnippetInserter } from '../common/smartSnippetInserter.js';
|
|
12
12
|
import { DefineKeybindingOverlayWidget } from 'vscode/vscode/vs/workbench/contrib/preferences/browser/keybindingWidgets';
|
|
@@ -14,7 +14,7 @@ import { parseTree } from 'vscode/vscode/vs/base/common/json';
|
|
|
14
14
|
import { WindowsNativeResolvedKeybinding } from '../../../services/keybinding/common/windowsKeyboardMapper.js';
|
|
15
15
|
import { themeColorFromId } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
16
16
|
import { overviewRulerError, overviewRulerInfo } from 'vscode/vscode/vs/editor/common/core/editorColorRegistry';
|
|
17
|
-
import { OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
|
|
17
|
+
import { TrackedRangeStickiness, OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
|
|
18
18
|
import { KeybindingParser } from 'vscode/vscode/vs/base/common/keybindingParser';
|
|
19
19
|
import { assertIsDefined } from 'vscode/vscode/vs/base/common/types';
|
|
20
20
|
import { isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
@@ -208,7 +208,7 @@ let KeybindingEditorDecorationsRenderer = KeybindingEditorDecorationsRenderer_1
|
|
|
208
208
|
range: range,
|
|
209
209
|
options: {
|
|
210
210
|
description: 'keybindings-widget',
|
|
211
|
-
stickiness:
|
|
211
|
+
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
|
212
212
|
className: className,
|
|
213
213
|
hoverMessage: msg,
|
|
214
214
|
overviewRuler: {
|
|
@@ -229,6 +229,6 @@ function isInterestingEditorModel(editor, userDataProfileService) {
|
|
|
229
229
|
}
|
|
230
230
|
return isEqual(model.uri, userDataProfileService.currentProfile.keybindingsResource);
|
|
231
231
|
}
|
|
232
|
-
registerEditorContribution(DEFINE_KEYBINDING_EDITOR_CONTRIB_ID, DefineKeybindingEditorContribution,
|
|
232
|
+
registerEditorContribution(DEFINE_KEYBINDING_EDITOR_CONTRIB_ID, DefineKeybindingEditorContribution, EditorContributionInstantiation.AfterFirstRender);
|
|
233
233
|
|
|
234
234
|
export { KeybindingEditorDecorationsRenderer };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { createScanner } from 'vscode/vscode/vs/base/common/json';
|
|
1
|
+
import { SyntaxKind, createScanner } from 'vscode/vscode/vs/base/common/json';
|
|
2
2
|
import { Position } from 'vscode/vscode/vs/editor/common/core/position';
|
|
3
3
|
import { Range } from 'vscode/vscode/vs/editor/common/core/range';
|
|
4
4
|
|
|
5
5
|
class SmartSnippetInserter {
|
|
6
6
|
static hasOpenBrace(scanner) {
|
|
7
|
-
while (scanner.scan() !==
|
|
7
|
+
while (scanner.scan() !== SyntaxKind.EOF) {
|
|
8
8
|
const kind = scanner.getToken();
|
|
9
|
-
if (kind ===
|
|
9
|
+
if (kind === SyntaxKind.OpenBraceToken) {
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -53,37 +53,37 @@ class SmartSnippetInserter {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
while (scanner.scan() !==
|
|
56
|
+
while (scanner.scan() !== SyntaxKind.EOF) {
|
|
57
57
|
const currentPos = scanner.getPosition();
|
|
58
58
|
const kind = scanner.getToken();
|
|
59
59
|
let goodKind = false;
|
|
60
60
|
switch (kind) {
|
|
61
|
-
case
|
|
61
|
+
case SyntaxKind.OpenBracketToken:
|
|
62
62
|
goodKind = true;
|
|
63
63
|
arrayLevel++;
|
|
64
64
|
checkRangeStatus(currentPos, State.BEFORE_OBJECT);
|
|
65
65
|
break;
|
|
66
|
-
case
|
|
66
|
+
case SyntaxKind.CloseBracketToken:
|
|
67
67
|
goodKind = true;
|
|
68
68
|
arrayLevel--;
|
|
69
69
|
checkRangeStatus(currentPos, State.INVALID);
|
|
70
70
|
break;
|
|
71
|
-
case
|
|
71
|
+
case SyntaxKind.CommaToken:
|
|
72
72
|
goodKind = true;
|
|
73
73
|
checkRangeStatus(currentPos, State.BEFORE_OBJECT);
|
|
74
74
|
break;
|
|
75
|
-
case
|
|
75
|
+
case SyntaxKind.OpenBraceToken:
|
|
76
76
|
goodKind = true;
|
|
77
77
|
objLevel++;
|
|
78
78
|
checkRangeStatus(currentPos, State.INVALID);
|
|
79
79
|
break;
|
|
80
|
-
case
|
|
80
|
+
case SyntaxKind.CloseBraceToken:
|
|
81
81
|
goodKind = true;
|
|
82
82
|
objLevel--;
|
|
83
83
|
checkRangeStatus(currentPos, State.AFTER_OBJECT);
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
86
|
-
case
|
|
85
|
+
case SyntaxKind.Trivia:
|
|
86
|
+
case SyntaxKind.LineBreakTrivia:
|
|
87
87
|
goodKind = true;
|
|
88
88
|
}
|
|
89
89
|
if (currentPos >= desiredPosition && (currentState !== State.INVALID || lastValidPos !== -1)) {
|
|
@@ -5,6 +5,7 @@ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extension
|
|
|
5
5
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
6
6
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
7
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
8
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
8
9
|
import { timeout } from 'vscode/vscode/vs/base/common/async';
|
|
9
10
|
|
|
10
11
|
let CommandService = class CommandService extends Disposable {
|