@codingame/monaco-vscode-keybindings-service-override 2.0.3 → 2.1.0
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-keybindings-service-override",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@2.0
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.1.0",
|
|
22
22
|
"vscode-marked": "npm:marked@=3.0.2",
|
|
23
|
-
"@codingame/monaco-vscode-files-service-override": "2.0
|
|
23
|
+
"@codingame/monaco-vscode-files-service-override": "2.1.0"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -3,7 +3,7 @@ import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
|
3
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
4
|
import { setConstant, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
5
5
|
import { IsMacContext, IsLinuxContext, IsWindowsContext, IsWebContext, IsMacNativeContext, IsIOSContext, IsMobileContext, IsDevelopmentContext, ProductQualityContext, InputFocusedContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
6
|
-
import { RemoteNameContext, VirtualWorkspaceContext, TemporaryWorkspaceContext, HasWebFileSystemAccess, EmbedderIdentifierContext, ActiveEditorContext, ActiveEditorReadonlyContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorCanRevertContext, ActiveEditorCanSplitInGroupContext, ActiveEditorAvailableEditorIdsContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, SideBySideEditorActiveContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, DirtyWorkingCopiesContext, WorkbenchStateContext, WorkspaceFolderCountContext, OpenFolderWorkspaceSupportContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, SplitEditorsVertically,
|
|
6
|
+
import { RemoteNameContext, VirtualWorkspaceContext, TemporaryWorkspaceContext, HasWebFileSystemAccess, EmbedderIdentifierContext, ActiveEditorContext, ActiveEditorReadonlyContext, ActiveCompareEditorOriginalWriteableContext, ActiveEditorCanToggleReadonlyContext, ActiveEditorCanRevertContext, ActiveEditorCanSplitInGroupContext, ActiveEditorAvailableEditorIdsContext, EditorsVisibleContext, TextCompareEditorVisibleContext, TextCompareEditorActiveContext, SideBySideEditorActiveContext, ActiveEditorGroupEmptyContext, ActiveEditorGroupIndexContext, ActiveEditorGroupLastContext, ActiveEditorGroupLockedContext, MultipleEditorGroupsContext, DirtyWorkingCopiesContext, WorkbenchStateContext, WorkspaceFolderCountContext, OpenFolderWorkspaceSupportContext, EmptyWorkspaceSupportContext, EnterMultiRootWorkspaceSupportContext, SplitEditorsVertically, IsMainWindowFullscreenContext, IsAuxiliaryWindowFocusedContext, InEditorZenModeContext, IsCenteredLayoutContext, MainEditorAreaVisibleContext, EditorTabsVisibleContext, SideBarVisibleContext, TitleBarVisibleContext, TitleBarStyleContext, PanelPositionContext, PanelVisibleContext, PanelMaximizedContext, PanelAlignmentContext, AuxiliaryBarVisibleContext, applyAvailableEditorIds } from 'vscode/vscode/vs/workbench/common/contextkeys';
|
|
7
7
|
import { TEXT_DIFF_EDITOR_ID, SIDE_BY_SIDE_EDITOR_ID, EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
8
8
|
import { onDidRegisterWindow, addDisposableListener, EventType, trackFocus, getActiveWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
9
9
|
import { preferredSideBySideGroupDirection, IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
@@ -23,6 +23,8 @@ import { IProductService } from 'vscode/vscode/vs/platform/product/common/produc
|
|
|
23
23
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
|
|
24
24
|
import { getTitleBarStyle } from 'vscode/vscode/vs/platform/window/common/window';
|
|
25
25
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
|
26
|
+
import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
|
|
27
|
+
import { onDidChangeFullscreen, isFullscreen } from 'vscode/vscode/vs/base/browser/browser';
|
|
26
28
|
|
|
27
29
|
let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disposable {
|
|
28
30
|
constructor(contextKeyService, contextService, configurationService, environmentService, productService, editorService, editorResolverService, editorGroupService, layoutService, paneCompositeService, workingCopyService, fileService) {
|
|
@@ -58,6 +60,7 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
58
60
|
EmbedderIdentifierContext.bindTo(this.contextKeyService).set(productService.embedderIdentifier);
|
|
59
61
|
this.activeEditorContext = ActiveEditorContext.bindTo(this.contextKeyService);
|
|
60
62
|
this.activeEditorIsReadonly = ActiveEditorReadonlyContext.bindTo(this.contextKeyService);
|
|
63
|
+
this.activeCompareEditorOriginalWritable = ActiveCompareEditorOriginalWriteableContext.bindTo(this.contextKeyService);
|
|
61
64
|
this.activeEditorCanToggleReadonly = ActiveEditorCanToggleReadonlyContext.bindTo(this.contextKeyService);
|
|
62
65
|
this.activeEditorCanRevert = ActiveEditorCanRevertContext.bindTo(this.contextKeyService);
|
|
63
66
|
this.activeEditorCanSplitInGroup = ActiveEditorCanSplitInGroupContext.bindTo(this.contextKeyService);
|
|
@@ -86,7 +89,7 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
86
89
|
this.enterMultiRootWorkspaceSupportContext.set(isNative || typeof this.environmentService.remoteAuthority === 'string');
|
|
87
90
|
this.splitEditorsVerticallyContext = SplitEditorsVertically.bindTo(this.contextKeyService);
|
|
88
91
|
this.updateSplitEditorsVerticallyContext();
|
|
89
|
-
this.
|
|
92
|
+
this.isMainWindowFullscreenContext = IsMainWindowFullscreenContext.bindTo(this.contextKeyService);
|
|
90
93
|
this.isAuxiliaryWindowFocusedContext = IsAuxiliaryWindowFocusedContext.bindTo(this.contextKeyService);
|
|
91
94
|
this.inZenModeContext = InEditorZenModeContext.bindTo(this.contextKeyService);
|
|
92
95
|
this.isCenteredLayoutContext = IsCenteredLayoutContext.bindTo(this.contextKeyService);
|
|
@@ -109,7 +112,7 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
109
112
|
this.registerListeners();
|
|
110
113
|
}
|
|
111
114
|
registerListeners() {
|
|
112
|
-
this.editorGroupService.
|
|
115
|
+
this.editorGroupService.whenReady.then(() => {
|
|
113
116
|
this.updateEditorAreaContextKeys();
|
|
114
117
|
this.updateEditorContextKeys();
|
|
115
118
|
});
|
|
@@ -134,7 +137,11 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
134
137
|
}));
|
|
135
138
|
this._register(this.layoutService.onDidChangeZenMode(enabled => this.inZenModeContext.set(enabled)));
|
|
136
139
|
this._register(this.layoutService.onDidChangeActiveContainer(() => this.isAuxiliaryWindowFocusedContext.set(this.layoutService.activeContainer !== this.layoutService.mainContainer)));
|
|
137
|
-
this._register(
|
|
140
|
+
this._register(onDidChangeFullscreen(windowId => {
|
|
141
|
+
if (windowId === mainWindow.vscodeWindowId) {
|
|
142
|
+
this.isMainWindowFullscreenContext.set(isFullscreen(mainWindow));
|
|
143
|
+
}
|
|
144
|
+
}));
|
|
138
145
|
this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered)));
|
|
139
146
|
this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position)));
|
|
140
147
|
this._register(this.layoutService.onDidChangePanelAlignment(alignment => this.panelAlignmentContext.set(alignment)));
|
|
@@ -177,12 +184,14 @@ let WorkbenchContextKeysHandler = class WorkbenchContextKeysHandler extends Disp
|
|
|
177
184
|
this.activeEditorCanSplitInGroup.set(activeEditorPane.input.hasCapability(32 ));
|
|
178
185
|
applyAvailableEditorIds(this.activeEditorAvailableEditorIds, activeEditorPane.input, this.editorResolverService);
|
|
179
186
|
this.activeEditorIsReadonly.set(!!activeEditorPane.input.isReadonly());
|
|
187
|
+
this.activeCompareEditorOriginalWritable.set(activeEditorPane.input instanceof DiffEditorInput && !activeEditorPane.input.original.isReadonly());
|
|
180
188
|
const primaryEditorResource = EditorResourceAccessor.getOriginalUri(activeEditorPane.input, { supportSideBySide: SideBySideEditor.PRIMARY });
|
|
181
189
|
this.activeEditorCanToggleReadonly.set(!!primaryEditorResource && this.fileService.hasProvider(primaryEditorResource) && !this.fileService.hasCapability(primaryEditorResource, 2048 ));
|
|
182
190
|
}
|
|
183
191
|
else {
|
|
184
192
|
this.activeEditorContext.reset();
|
|
185
193
|
this.activeEditorIsReadonly.reset();
|
|
194
|
+
this.activeCompareEditorOriginalWritable.reset();
|
|
186
195
|
this.activeEditorCanToggleReadonly.reset();
|
|
187
196
|
this.activeEditorCanRevert.reset();
|
|
188
197
|
this.activeEditorCanSplitInGroup.reset();
|
|
@@ -225,6 +225,66 @@ const apiMenus = [
|
|
|
225
225
|
)),
|
|
226
226
|
proposed: 'contribSourceControlInputBoxMenu'
|
|
227
227
|
},
|
|
228
|
+
{
|
|
229
|
+
key: 'scm/incomingChanges',
|
|
230
|
+
id: MenuId.SCMIncomingChanges,
|
|
231
|
+
description: ( localizeWithPath(
|
|
232
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
233
|
+
'menus.incomingChanges',
|
|
234
|
+
"The Source Control incoming changes menu"
|
|
235
|
+
)),
|
|
236
|
+
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
key: 'scm/outgoingChanges',
|
|
240
|
+
id: MenuId.SCMOutgoingChanges,
|
|
241
|
+
description: ( localizeWithPath(
|
|
242
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
243
|
+
'menus.outgoingChanges',
|
|
244
|
+
"The Source Control outgoing changes menu"
|
|
245
|
+
)),
|
|
246
|
+
proposed: 'contribSourceControlHistoryItemGroupMenu'
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
key: 'scm/incomingChanges/allChanges/context',
|
|
250
|
+
id: MenuId.SCMIncomingChangesAllChangesContext,
|
|
251
|
+
description: ( localizeWithPath(
|
|
252
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
253
|
+
'menus.incomingChangesAllChangesContext',
|
|
254
|
+
"The Source Control all incoming changes context menu"
|
|
255
|
+
)),
|
|
256
|
+
proposed: 'contribSourceControlHistoryItemMenu'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
key: 'scm/incomingChanges/historyItem/context',
|
|
260
|
+
id: MenuId.SCMIncomingChangesHistoryItemContext,
|
|
261
|
+
description: ( localizeWithPath(
|
|
262
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
263
|
+
'menus.incomingChangesHistoryItemContext',
|
|
264
|
+
"The Source Control incoming changes history item context menu"
|
|
265
|
+
)),
|
|
266
|
+
proposed: 'contribSourceControlHistoryItemMenu'
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
key: 'scm/outgoingChanges/allChanges/context',
|
|
270
|
+
id: MenuId.SCMOutgoingChangesAllChangesContext,
|
|
271
|
+
description: ( localizeWithPath(
|
|
272
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
273
|
+
'menus.outgoingChangesAllChangesContext',
|
|
274
|
+
"The Source Control all outgoing changes context menu"
|
|
275
|
+
)),
|
|
276
|
+
proposed: 'contribSourceControlHistoryItemMenu'
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
key: 'scm/outgoingChanges/historyItem/context',
|
|
280
|
+
id: MenuId.SCMOutgoingChangesHistoryItemContext,
|
|
281
|
+
description: ( localizeWithPath(
|
|
282
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
283
|
+
'menus.outgoingChangesHistoryItemContext',
|
|
284
|
+
"The Source Control outgoing changes history item context menu"
|
|
285
|
+
)),
|
|
286
|
+
proposed: 'contribSourceControlHistoryItemMenu'
|
|
287
|
+
},
|
|
228
288
|
{
|
|
229
289
|
key: 'statusBar/remoteIndicator',
|
|
230
290
|
id: MenuId.StatusBarRemoteIndicatorMenu,
|
|
@@ -564,6 +624,16 @@ const apiMenus = [
|
|
|
564
624
|
)),
|
|
565
625
|
proposed: 'contribMergeEditorMenus'
|
|
566
626
|
},
|
|
627
|
+
{
|
|
628
|
+
key: 'multiDiffEditor/resource/title',
|
|
629
|
+
id: MenuId.MultiDiffEditorFileToolbar,
|
|
630
|
+
description: ( localizeWithPath(
|
|
631
|
+
'vs/workbench/services/actions/common/menusExtensionPoint',
|
|
632
|
+
'menus.multiDiffEditorResource',
|
|
633
|
+
"The resource toolbar in the multi diff editor"
|
|
634
|
+
)),
|
|
635
|
+
proposed: 'contribMultiDiffEditorMenus'
|
|
636
|
+
}
|
|
567
637
|
];
|
|
568
638
|
var schema;
|
|
569
639
|
( (function(schema) {
|
|
@@ -2,9 +2,9 @@ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.e
|
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { onDidChangeFullscreen, isFullscreen } from 'vscode/vscode/vs/base/browser/browser';
|
|
4
4
|
import { BrowserFeatures } from 'vscode/vscode/vs/base/browser/canIUse';
|
|
5
|
-
import { onDidRegisterWindow, addDisposableListener, EventType } from 'vscode/vscode/vs/base/browser/dom';
|
|
5
|
+
import { onDidRegisterWindow, addDisposableListener, EventType, trackFocus, getWindow } from 'vscode/vscode/vs/base/browser/dom';
|
|
6
6
|
import { StandardKeyboardEvent, printKeyboardEvent, printStandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
7
|
-
import { RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
7
|
+
import { DeferredPromise, RunOnceScheduler } from 'vscode/vscode/vs/base/common/async';
|
|
8
8
|
import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
9
9
|
import { parse } from 'vscode/vscode/vs/base/common/json';
|
|
10
10
|
import { UserSettingsLabelProvider } from 'vscode/vscode/vs/base/common/keybindingLabels';
|
|
@@ -227,6 +227,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
227
227
|
this._keyboardMapper = this.keyboardLayoutService.getKeyboardMapper();
|
|
228
228
|
this.updateResolver();
|
|
229
229
|
});
|
|
230
|
+
this._keybindingHoldMode = null;
|
|
230
231
|
this._cachedResolver = null;
|
|
231
232
|
this.userKeybindings = this._register(( new UserKeybindings(userDataProfileService, uriIdentityService, fileService, logService)));
|
|
232
233
|
this.userKeybindings.initialize().then(() => {
|
|
@@ -249,12 +250,15 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
249
250
|
this.updateKeybindingsJsonSchema();
|
|
250
251
|
this._register(extensionService.onDidRegisterExtensions(() => this.updateKeybindingsJsonSchema()));
|
|
251
252
|
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => disposables.add(this._registerKeyListeners(window)), { window: mainWindow, disposables: this._store }));
|
|
252
|
-
this._register(onDidChangeFullscreen(
|
|
253
|
+
this._register(onDidChangeFullscreen(windowId => {
|
|
254
|
+
if (windowId !== mainWindow.vscodeWindowId) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
253
257
|
const keyboard = navigator.keyboard;
|
|
254
258
|
if (BrowserFeatures.keyboard === 2 ) {
|
|
255
259
|
return;
|
|
256
260
|
}
|
|
257
|
-
if (isFullscreen()) {
|
|
261
|
+
if (isFullscreen(mainWindow)) {
|
|
258
262
|
keyboard?.lock(['Escape']);
|
|
259
263
|
}
|
|
260
264
|
else {
|
|
@@ -267,6 +271,9 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
267
271
|
_registerKeyListeners(window) {
|
|
268
272
|
const disposables = ( new DisposableStore());
|
|
269
273
|
disposables.add(addDisposableListener(window, EventType.KEY_DOWN, (e) => {
|
|
274
|
+
if (this._keybindingHoldMode) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
270
277
|
this.isComposingGlobalContextKey.set(e.isComposing);
|
|
271
278
|
const keyEvent = ( new StandardKeyboardEvent(e));
|
|
272
279
|
this._log(`/ Received keydown event - ${printKeyboardEvent(e)}`);
|
|
@@ -278,6 +285,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
278
285
|
this.isComposingGlobalContextKey.set(false);
|
|
279
286
|
}));
|
|
280
287
|
disposables.add(addDisposableListener(window, EventType.KEY_UP, (e) => {
|
|
288
|
+
this._resetKeybindingHoldMode();
|
|
281
289
|
this.isComposingGlobalContextKey.set(e.isComposing);
|
|
282
290
|
const keyEvent = ( new StandardKeyboardEvent(e));
|
|
283
291
|
const shouldPreventDefault = this._singleModifierDispatch(keyEvent, keyEvent.target);
|
|
@@ -367,6 +375,26 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
367
375
|
};
|
|
368
376
|
return JSON.stringify(info, null, '\t');
|
|
369
377
|
}
|
|
378
|
+
enableKeybindingHoldMode(commandId) {
|
|
379
|
+
if (this._currentlyDispatchingCommandId !== commandId) {
|
|
380
|
+
return undefined;
|
|
381
|
+
}
|
|
382
|
+
this._keybindingHoldMode = ( new DeferredPromise());
|
|
383
|
+
const focusTracker = trackFocus(getWindow(undefined));
|
|
384
|
+
const listener = focusTracker.onDidBlur(() => this._resetKeybindingHoldMode());
|
|
385
|
+
this._keybindingHoldMode.p.finally(() => {
|
|
386
|
+
listener.dispose();
|
|
387
|
+
focusTracker.dispose();
|
|
388
|
+
});
|
|
389
|
+
this._log(`+ Enabled hold-mode for ${commandId}.`);
|
|
390
|
+
return this._keybindingHoldMode.p;
|
|
391
|
+
}
|
|
392
|
+
_resetKeybindingHoldMode() {
|
|
393
|
+
if (this._keybindingHoldMode) {
|
|
394
|
+
this._keybindingHoldMode?.complete();
|
|
395
|
+
this._keybindingHoldMode = null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
370
398
|
customKeybindingsCount() {
|
|
371
399
|
return this.userKeybindings.keybindings.length;
|
|
372
400
|
}
|
|
@@ -455,7 +483,7 @@ let WorkbenchKeybindingService = WorkbenchKeybindingService_1 = class WorkbenchK
|
|
|
455
483
|
if (BrowserFeatures.keyboard === 0 ) {
|
|
456
484
|
return false;
|
|
457
485
|
}
|
|
458
|
-
if (BrowserFeatures.keyboard === 1 && isFullscreen()) {
|
|
486
|
+
if (BrowserFeatures.keyboard === 1 && isFullscreen(mainWindow)) {
|
|
459
487
|
return false;
|
|
460
488
|
}
|
|
461
489
|
for (const chord of keybinding.chords) {
|