@codingame/monaco-vscode-keybindings-service-override 1.83.8 → 1.83.10-next.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/external/tslib/tslib.es6.js +11 -0
- package/index.js +1 -2
- package/keybindings.js +100 -0
- package/monaco.js +231 -0
- package/package.json +4 -3
- package/tools/injection.js +17 -0
- package/vscode/src/vs/base/common/keybindingParser.js +89 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +50 -0
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardMapper.js +24 -0
- package/vscode/src/vs/workbench/browser/contextkeys.js +251 -0
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +29 -0
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +1288 -0
- package/vscode/src/vs/workbench/services/commands/common/commandService.js +79 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +919 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +500 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution.js +14 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/cz.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de-swiss.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dk.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dvorak.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-belgian.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-ext.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-in.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.darwin.js +134 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.linux.js +183 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.win.js +168 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es-latin.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/hu.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp-roman.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ko.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin.js +17 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux.js +6 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win.js +23 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/no.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt-br.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.linux.js +181 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/sv.win.js +165 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/thai.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/tr.win.js +163 -0
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/zh-hans.darwin.js +126 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +74 -0
- package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.js +110 -0
- package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +888 -0
- package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +352 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function __decorate(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
}
|
|
7
|
+
function __param(paramIndex, decorator) {
|
|
8
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { __decorate, __param };
|
package/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { default } from 'vscode/service-override/keybindings';
|
|
1
|
+
export { default, defaultUserKeybindindsFile, initUserKeybindings, updateUserKeybindings } from './keybindings.js';
|
package/keybindings.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { __decorate, __param } from './external/tslib/tslib.es6.js';
|
|
2
|
+
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
3
|
+
import { SyncDescriptor } from 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
4
|
+
import { WorkbenchKeybindingService } from './vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js';
|
|
5
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
6
|
+
import { VSBuffer } from 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
7
|
+
import { IUserDataProfilesService } from 'monaco-editor/esm/vs/platform/userDataProfile/common/userDataProfile.js';
|
|
8
|
+
import { IKeyboardLayoutService } from 'vscode/vscode/vs/platform/keyboardLayout/common/keyboardLayout';
|
|
9
|
+
import { BrowserKeyboardLayoutService } from './vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js';
|
|
10
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
11
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
12
|
+
import { CommandService } from './vscode/src/vs/workbench/services/commands/common/commandService.js';
|
|
13
|
+
import { DisposableStore, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
14
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
15
|
+
import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
|
|
16
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
17
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
18
|
+
import { IUserDataProfileService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
19
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host';
|
|
20
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
21
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
22
|
+
import { WorkbenchContextKeysHandler } from './vscode/src/vs/workbench/browser/contextkeys.js';
|
|
23
|
+
import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
|
|
24
|
+
import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
|
|
25
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
26
|
+
import getServiceOverride$1, { initFile } from '@codingame/monaco-vscode-files-service-override';
|
|
27
|
+
import './monaco.js';
|
|
28
|
+
import { onRenderWorkbench } from 'vscode/lifecycle';
|
|
29
|
+
import 'vscode/vscode/vs/workbench/browser/workbench.contribution';
|
|
30
|
+
import './vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js';
|
|
31
|
+
|
|
32
|
+
const defaultUserKeybindindsFile = ( URI.from({ scheme: Schemas.vscodeUserData, path: '/User/keybindings.json' }));
|
|
33
|
+
async function initUserKeybindings(configurationJson, options, file = defaultUserKeybindindsFile) {
|
|
34
|
+
await initFile(file, configurationJson, options);
|
|
35
|
+
}
|
|
36
|
+
async function updateUserKeybindings(keybindingsJson) {
|
|
37
|
+
const userDataProfilesService = StandaloneServices.get(IUserDataProfilesService);
|
|
38
|
+
await StandaloneServices.get(IFileService).writeFile(userDataProfilesService.defaultProfile.keybindingsResource, VSBuffer.fromString(keybindingsJson));
|
|
39
|
+
}
|
|
40
|
+
let DynamicWorkbenchKeybindingService = class DynamicWorkbenchKeybindingService extends WorkbenchKeybindingService {
|
|
41
|
+
constructor(shouldUseGlobalKeybindings, contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, uriIdentityService, logService, keyboardLayoutService) {
|
|
42
|
+
super(contextKeyService, commandService, telemetryService, notificationService, userDataProfileService, hostService, extensionService, fileService, uriIdentityService, logService, keyboardLayoutService);
|
|
43
|
+
this.shouldUseGlobalKeybindings = shouldUseGlobalKeybindings;
|
|
44
|
+
this.keybindingProviders = [];
|
|
45
|
+
}
|
|
46
|
+
registerKeybindingProvider(provider) {
|
|
47
|
+
this.keybindingProviders.push(provider);
|
|
48
|
+
this.updateResolver();
|
|
49
|
+
const store = new DisposableStore();
|
|
50
|
+
store.add(provider.onDidChangeKeybindings(() => {
|
|
51
|
+
this.updateResolver();
|
|
52
|
+
}));
|
|
53
|
+
store.add(toDisposable(() => {
|
|
54
|
+
const idx = this.keybindingProviders.indexOf(provider);
|
|
55
|
+
if (idx >= 0) {
|
|
56
|
+
this.keybindingProviders.splice(idx, 1);
|
|
57
|
+
this.updateResolver();
|
|
58
|
+
}
|
|
59
|
+
}));
|
|
60
|
+
return store;
|
|
61
|
+
}
|
|
62
|
+
_getResolver() {
|
|
63
|
+
return super._getResolver();
|
|
64
|
+
}
|
|
65
|
+
_dispatch(e, target) {
|
|
66
|
+
if (!this.shouldUseGlobalKeybindings()) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return super._dispatch(e, target);
|
|
70
|
+
}
|
|
71
|
+
getUserKeybindingItems() {
|
|
72
|
+
return [...super.getUserKeybindingItems(), ...this.keybindingProviders.flatMap(provider => provider.provideKeybindings())];
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
DynamicWorkbenchKeybindingService = __decorate([
|
|
76
|
+
( __param(1, IContextKeyService)),
|
|
77
|
+
( __param(2, ICommandService)),
|
|
78
|
+
( __param(3, ITelemetryService)),
|
|
79
|
+
( __param(4, INotificationService)),
|
|
80
|
+
( __param(5, IUserDataProfileService)),
|
|
81
|
+
( __param(6, IHostService)),
|
|
82
|
+
( __param(7, IExtensionService)),
|
|
83
|
+
( __param(8, IFileService)),
|
|
84
|
+
( __param(9, IUriIdentityService)),
|
|
85
|
+
( __param(10, ILogService)),
|
|
86
|
+
( __param(11, IKeyboardLayoutService))
|
|
87
|
+
], DynamicWorkbenchKeybindingService);
|
|
88
|
+
onRenderWorkbench((accessor) => {
|
|
89
|
+
accessor.get(IInstantiationService).createInstance(WorkbenchContextKeysHandler);
|
|
90
|
+
});
|
|
91
|
+
function getServiceOverride({ shouldUseGlobalKeybindings = () => false } = {}) {
|
|
92
|
+
return {
|
|
93
|
+
...getServiceOverride$1(),
|
|
94
|
+
[( IKeybindingService.toString())]: new SyncDescriptor(DynamicWorkbenchKeybindingService, [shouldUseGlobalKeybindings], false),
|
|
95
|
+
[( IKeyboardLayoutService.toString())]: new SyncDescriptor(BrowserKeyboardLayoutService, undefined, true),
|
|
96
|
+
[( ICommandService.toString())]: new SyncDescriptor(CommandService, [], true)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { getServiceOverride as default, defaultUserKeybindindsFile, initUserKeybindings, updateUserKeybindings };
|
package/monaco.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { __decorate, __param } from './external/tslib/tslib.es6.js';
|
|
2
|
+
import { StandaloneKeybindingService } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
3
|
+
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
4
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
5
|
+
import { StandaloneEditor, StandaloneDiffEditor2 } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneCodeEditor.js';
|
|
6
|
+
import { isObject } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
7
|
+
import { distinct, deepClone } from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
8
|
+
export { errorHandler } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
9
|
+
export { FoldingModel, setCollapseStateForMatchingLines } from 'monaco-editor/esm/vs/editor/contrib/folding/browser/foldingModel.js';
|
|
10
|
+
export { FoldingController } from 'monaco-editor/esm/vs/editor/contrib/folding/browser/folding.js';
|
|
11
|
+
export { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
12
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
13
|
+
export { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
14
|
+
import { Extensions as Extensions$1 } from 'monaco-editor/esm/vs/platform/jsonschemas/common/jsonContributionRegistry.js';
|
|
15
|
+
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
16
|
+
export { CommandsRegistry } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
|
|
17
|
+
export { MenuId, MenuRegistry } from 'monaco-editor/esm/vs/platform/actions/common/actions.js';
|
|
18
|
+
export { KeybindingsRegistry } from 'monaco-editor/esm/vs/platform/keybinding/common/keybindingsRegistry.js';
|
|
19
|
+
import { Extensions as Extensions$2 } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
20
|
+
import { EditorOptionsUtil } from 'vscode/vscode/vs/editor/browser/config/editorConfiguration';
|
|
21
|
+
export { registerColor } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
22
|
+
import 'monaco-editor/esm/vs/editor/common/services/resolverService.js';
|
|
23
|
+
import 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
24
|
+
import 'monaco-editor/esm/vs/base/common/buffer.js';
|
|
25
|
+
import { JSONValidationExtensionPoint } from 'vscode/vscode/vs/workbench/api/common/jsonValidationExtensionPoint';
|
|
26
|
+
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
27
|
+
import { ColorExtensionPoint } from 'vscode/vscode/vs/workbench/services/themes/common/colorExtensionPoint';
|
|
28
|
+
import 'monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js';
|
|
29
|
+
import 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
30
|
+
import 'monaco-editor/esm/vs/editor/standalone/browser/quickInput/standaloneQuickInputService.js';
|
|
31
|
+
import 'monaco-editor/esm/vs/platform/instantiation/common/descriptors.js';
|
|
32
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
33
|
+
export { ContextKeyExpr, RawContextKey } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
34
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
35
|
+
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
36
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
37
|
+
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
38
|
+
import 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
39
|
+
import { Emitter } from 'monaco-editor';
|
|
40
|
+
import { createInjectedClass } from './tools/injection.js';
|
|
41
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch';
|
|
42
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/menuPreventer';
|
|
43
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/diffEditorHelper';
|
|
44
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations';
|
|
45
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/inspectEditorTokens/inspectEditorTokens';
|
|
46
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/saveParticipants';
|
|
47
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/toggleMinimap';
|
|
48
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier';
|
|
49
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/toggleRenderControlCharacter';
|
|
50
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/toggleWordWrap';
|
|
51
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/toggleRenderWhitespace';
|
|
52
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/editorLineNumberMenu';
|
|
53
|
+
import 'vscode/vscode/vs/workbench/contrib/folding/browser/folding.contribution';
|
|
54
|
+
import 'vscode/vscode/vs/workbench/contrib/inlayHints/browser/inlayHintsAccessibilty';
|
|
55
|
+
import 'vscode/vscode/vs/workbench/contrib/codeActions/browser/codeActions.contribution';
|
|
56
|
+
import 'vscode/vscode/vs/workbench/contrib/list/browser/list.contribution';
|
|
57
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/editorFeatures';
|
|
58
|
+
|
|
59
|
+
let ExtensionPoints = class ExtensionPoints {
|
|
60
|
+
constructor(instantiationService) {
|
|
61
|
+
this.instantiationService = instantiationService;
|
|
62
|
+
this.instantiationService.createInstance(JSONValidationExtensionPoint);
|
|
63
|
+
this.instantiationService.createInstance(ColorExtensionPoint);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
ExtensionPoints = __decorate([
|
|
67
|
+
( __param(0, IInstantiationService))
|
|
68
|
+
], ExtensionPoints);
|
|
69
|
+
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(ExtensionPoints, 1 );
|
|
70
|
+
function computeConfiguration(configuration, overrides) {
|
|
71
|
+
const editorConfiguration = isObject(configuration.editor) ? deepClone(configuration.editor) : Object.create(null);
|
|
72
|
+
Object.assign(editorConfiguration, deepClone(overrides));
|
|
73
|
+
return editorConfiguration;
|
|
74
|
+
}
|
|
75
|
+
function computeDiffConfiguration(configuration, overrides) {
|
|
76
|
+
const editorConfiguration = computeConfiguration(configuration);
|
|
77
|
+
if (isObject(configuration.diffEditor)) {
|
|
78
|
+
const diffEditorConfiguration = deepClone(configuration.diffEditor);
|
|
79
|
+
diffEditorConfiguration.diffCodeLens = diffEditorConfiguration.codeLens;
|
|
80
|
+
delete diffEditorConfiguration.codeLens;
|
|
81
|
+
diffEditorConfiguration.diffWordWrap = diffEditorConfiguration.wordWrap;
|
|
82
|
+
delete diffEditorConfiguration.wordWrap;
|
|
83
|
+
Object.assign(editorConfiguration, diffEditorConfiguration);
|
|
84
|
+
}
|
|
85
|
+
editorConfiguration.accessibilityVerbose = configuration.accessibility?.verbosity?.diffEditor ?? false;
|
|
86
|
+
Object.assign(editorConfiguration, deepClone(overrides));
|
|
87
|
+
return editorConfiguration;
|
|
88
|
+
}
|
|
89
|
+
let ConfiguredStandaloneEditor = class ConfiguredStandaloneEditor extends createInjectedClass(StandaloneEditor) {
|
|
90
|
+
constructor(domElement, _options = {}, instantiationService, textResourceConfigurationService) {
|
|
91
|
+
const { theme, autoDetectHighContrast, model, value, language, accessibilityHelpUrl, ariaContainerElement, overflowWidgetsDomNode, dimension, ...options } = _options;
|
|
92
|
+
const computedOptions = computeConfiguration(textResourceConfigurationService.getValue(_options.model?.uri), options);
|
|
93
|
+
super(instantiationService, domElement, { ...computedOptions, overflowWidgetsDomNode, dimension, theme, autoDetectHighContrast, model, value, language, accessibilityHelpUrl, ariaContainerElement });
|
|
94
|
+
this.textResourceConfigurationService = textResourceConfigurationService;
|
|
95
|
+
this.optionsOverrides = {};
|
|
96
|
+
this.lastAppliedEditorOptions = computedOptions;
|
|
97
|
+
this.optionsOverrides = options;
|
|
98
|
+
this._register(textResourceConfigurationService.onDidChangeConfiguration((e) => {
|
|
99
|
+
const resource = this.getModel()?.uri;
|
|
100
|
+
if (resource != null && e.affectsConfiguration(resource, 'editor')) {
|
|
101
|
+
this.updateEditorConfiguration();
|
|
102
|
+
}
|
|
103
|
+
}));
|
|
104
|
+
this._register(this.onDidChangeModelLanguage(() => this.updateEditorConfiguration()));
|
|
105
|
+
this._register(this.onDidChangeModel(() => this.updateEditorConfiguration()));
|
|
106
|
+
this.updateEditorConfiguration();
|
|
107
|
+
}
|
|
108
|
+
updateEditorConfiguration() {
|
|
109
|
+
if (!this.hasModel() || this.textResourceConfigurationService == null) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const resource = this.getModel().uri;
|
|
113
|
+
const configuration = this.textResourceConfigurationService.getValue(resource);
|
|
114
|
+
if (configuration == null) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const editorConfiguration = computeConfiguration(configuration, this.optionsOverrides);
|
|
118
|
+
let editorSettingsToApply = editorConfiguration;
|
|
119
|
+
if (this.lastAppliedEditorOptions != null) {
|
|
120
|
+
editorSettingsToApply = distinct(this.lastAppliedEditorOptions, editorSettingsToApply);
|
|
121
|
+
}
|
|
122
|
+
if (( Object.keys(editorSettingsToApply)).length > 0) {
|
|
123
|
+
this.lastAppliedEditorOptions = editorConfiguration;
|
|
124
|
+
super.updateOptions(editorSettingsToApply);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
updateOptions(newOptions) {
|
|
128
|
+
this.optionsOverrides ?? (this.optionsOverrides = {});
|
|
129
|
+
const didChange = EditorOptionsUtil.applyUpdate(this.optionsOverrides, newOptions);
|
|
130
|
+
if (!didChange) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this.updateEditorConfiguration();
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
ConfiguredStandaloneEditor = __decorate([
|
|
137
|
+
( __param(2, IInstantiationService)),
|
|
138
|
+
( __param(3, ITextResourceConfigurationService))
|
|
139
|
+
], ConfiguredStandaloneEditor);
|
|
140
|
+
let ConfiguredStandaloneDiffEditor = class ConfiguredStandaloneDiffEditor extends createInjectedClass(StandaloneDiffEditor2) {
|
|
141
|
+
constructor(domElement, _options = {}, instantiationService, textResourceConfigurationService) {
|
|
142
|
+
const { theme, autoDetectHighContrast, modifiedAriaLabel, originalAriaLabel, overflowWidgetsDomNode, dimension, ...options } = _options;
|
|
143
|
+
const computedOptions = computeDiffConfiguration(textResourceConfigurationService.getValue(undefined), options);
|
|
144
|
+
super(instantiationService, domElement, { ...computedOptions, overflowWidgetsDomNode, dimension, theme, autoDetectHighContrast, modifiedAriaLabel, originalAriaLabel });
|
|
145
|
+
this.textResourceConfigurationService = textResourceConfigurationService;
|
|
146
|
+
this.optionsOverrides = {};
|
|
147
|
+
this.lastAppliedEditorOptions = computedOptions;
|
|
148
|
+
this.optionsOverrides = options;
|
|
149
|
+
this._register(textResourceConfigurationService.onDidChangeConfiguration((e) => {
|
|
150
|
+
const resource = this._targetEditor.getModel()?.uri;
|
|
151
|
+
if (resource != null && (e.affectsConfiguration(resource, 'editor') || e.affectsConfiguration(resource, 'diffEditor') || e.affectsConfiguration(resource, 'accessibility.verbosity.diffEditor'))) {
|
|
152
|
+
this.updateEditorConfiguration();
|
|
153
|
+
}
|
|
154
|
+
}));
|
|
155
|
+
this._register(this._targetEditor.onDidChangeModelLanguage(() => this.updateEditorConfiguration()));
|
|
156
|
+
this._register(this.onDidChangeModel(() => this.updateEditorConfiguration()));
|
|
157
|
+
this.updateEditorConfiguration();
|
|
158
|
+
}
|
|
159
|
+
updateEditorConfiguration() {
|
|
160
|
+
if (this.getModel() == null || this.textResourceConfigurationService == null) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const resource = this._targetEditor.getModel()?.uri;
|
|
164
|
+
const configuration = this.textResourceConfigurationService.getValue(resource);
|
|
165
|
+
if (configuration == null) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const editorConfiguration = computeDiffConfiguration(configuration, this.optionsOverrides);
|
|
169
|
+
let editorSettingsToApply = editorConfiguration;
|
|
170
|
+
if (this.lastAppliedEditorOptions != null) {
|
|
171
|
+
editorSettingsToApply = distinct(this.lastAppliedEditorOptions, editorSettingsToApply);
|
|
172
|
+
}
|
|
173
|
+
if (( Object.keys(editorSettingsToApply)).length > 0) {
|
|
174
|
+
this.lastAppliedEditorOptions = editorConfiguration;
|
|
175
|
+
super.updateOptions(editorSettingsToApply);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
updateOptions(newOptions) {
|
|
179
|
+
this.optionsOverrides ?? (this.optionsOverrides = {});
|
|
180
|
+
this.optionsOverrides = {
|
|
181
|
+
...this.optionsOverrides,
|
|
182
|
+
...newOptions
|
|
183
|
+
};
|
|
184
|
+
this.updateEditorConfiguration();
|
|
185
|
+
}
|
|
186
|
+
_createInnerEditor(instantiationService, container, options) {
|
|
187
|
+
return instantiationService.createInstance(ConfiguredStandaloneEditor, container, options);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
ConfiguredStandaloneDiffEditor = __decorate([
|
|
191
|
+
( __param(2, IInstantiationService)),
|
|
192
|
+
( __param(3, ITextResourceConfigurationService))
|
|
193
|
+
], ConfiguredStandaloneDiffEditor);
|
|
194
|
+
let DelegateStandaloneKeybindingService = class DelegateStandaloneKeybindingService extends StandaloneKeybindingService {
|
|
195
|
+
constructor(delegate, contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService) {
|
|
196
|
+
super(contextKeyService, commandService, telemetryService, notificationService, logService, codeEditorService);
|
|
197
|
+
this.delegate = delegate;
|
|
198
|
+
this._onDidChangeKeybindings = new Emitter();
|
|
199
|
+
this._register(delegate.registerKeybindingProvider({
|
|
200
|
+
provideKeybindings: () => {
|
|
201
|
+
return this.getUserKeybindingItems();
|
|
202
|
+
},
|
|
203
|
+
onDidChangeKeybindings: this._onDidChangeKeybindings.event
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
_getResolver() {
|
|
207
|
+
return this.delegate._getResolver();
|
|
208
|
+
}
|
|
209
|
+
updateResolver() {
|
|
210
|
+
super.updateResolver();
|
|
211
|
+
this._onDidChangeKeybindings.fire();
|
|
212
|
+
}
|
|
213
|
+
resolveKeyboardEvent(keyboardEvent) {
|
|
214
|
+
return this.delegate.resolveKeyboardEvent(keyboardEvent);
|
|
215
|
+
}
|
|
216
|
+
resolveKeybinding(keybinding) {
|
|
217
|
+
return this.delegate.resolveKeybinding(keybinding);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
DelegateStandaloneKeybindingService = __decorate([
|
|
221
|
+
( __param(1, IContextKeyService)),
|
|
222
|
+
( __param(2, ICommandService)),
|
|
223
|
+
( __param(3, ITelemetryService)),
|
|
224
|
+
( __param(4, INotificationService)),
|
|
225
|
+
( __param(5, ILogService)),
|
|
226
|
+
( __param(6, ICodeEditorService))
|
|
227
|
+
], DelegateStandaloneKeybindingService);
|
|
228
|
+
({
|
|
229
|
+
...Extensions$1,
|
|
230
|
+
...Extensions$2
|
|
231
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-keybindings-service-override",
|
|
3
|
-
"version": "1.83.
|
|
3
|
+
"version": "1.83.10-next.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.83.
|
|
22
|
-
"monaco-editor": "0.44.0"
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.83.10-next.0",
|
|
22
|
+
"monaco-editor": "0.44.0",
|
|
23
|
+
"@codingame/monaco-vscode-files-service-override": "1.83.10-next.0"
|
|
23
24
|
}
|
|
24
25
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { _util } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
2
|
+
|
|
3
|
+
function getInjectedParameters(instantiationService, ctor) {
|
|
4
|
+
return instantiationService.invokeFunction((accessor) => {
|
|
5
|
+
return ( _util.getServiceDependencies(ctor).sort((a, b) => a.index - b.index).map(d => accessor.get(d.id)));
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
function createInjectedClass(ctor) {
|
|
9
|
+
const _ctor = ctor;
|
|
10
|
+
return class extends _ctor {
|
|
11
|
+
constructor(...args) {
|
|
12
|
+
super(...args.slice(1), ...getInjectedParameters(args[0], ctor));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { createInjectedClass };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ScanCodeUtils, KeyCodeUtils } from 'monaco-editor/esm/vs/base/common/keyCodes.js';
|
|
2
|
+
import { ScanCodeChord, KeyCodeChord, Keybinding } from 'monaco-editor/esm/vs/base/common/keybindings.js';
|
|
3
|
+
|
|
4
|
+
class KeybindingParser {
|
|
5
|
+
static _readModifiers(input) {
|
|
6
|
+
input = input.toLowerCase().trim();
|
|
7
|
+
let ctrl = false;
|
|
8
|
+
let shift = false;
|
|
9
|
+
let alt = false;
|
|
10
|
+
let meta = false;
|
|
11
|
+
let matchedModifier;
|
|
12
|
+
do {
|
|
13
|
+
matchedModifier = false;
|
|
14
|
+
if (/^ctrl(\+|\-)/.test(input)) {
|
|
15
|
+
ctrl = true;
|
|
16
|
+
input = input.substr('ctrl-'.length);
|
|
17
|
+
matchedModifier = true;
|
|
18
|
+
}
|
|
19
|
+
if (/^shift(\+|\-)/.test(input)) {
|
|
20
|
+
shift = true;
|
|
21
|
+
input = input.substr('shift-'.length);
|
|
22
|
+
matchedModifier = true;
|
|
23
|
+
}
|
|
24
|
+
if (/^alt(\+|\-)/.test(input)) {
|
|
25
|
+
alt = true;
|
|
26
|
+
input = input.substr('alt-'.length);
|
|
27
|
+
matchedModifier = true;
|
|
28
|
+
}
|
|
29
|
+
if (/^meta(\+|\-)/.test(input)) {
|
|
30
|
+
meta = true;
|
|
31
|
+
input = input.substr('meta-'.length);
|
|
32
|
+
matchedModifier = true;
|
|
33
|
+
}
|
|
34
|
+
if (/^win(\+|\-)/.test(input)) {
|
|
35
|
+
meta = true;
|
|
36
|
+
input = input.substr('win-'.length);
|
|
37
|
+
matchedModifier = true;
|
|
38
|
+
}
|
|
39
|
+
if (/^cmd(\+|\-)/.test(input)) {
|
|
40
|
+
meta = true;
|
|
41
|
+
input = input.substr('cmd-'.length);
|
|
42
|
+
matchedModifier = true;
|
|
43
|
+
}
|
|
44
|
+
} while (matchedModifier);
|
|
45
|
+
let key;
|
|
46
|
+
const firstSpaceIdx = input.indexOf(' ');
|
|
47
|
+
if (firstSpaceIdx > 0) {
|
|
48
|
+
key = input.substring(0, firstSpaceIdx);
|
|
49
|
+
input = input.substring(firstSpaceIdx);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
key = input;
|
|
53
|
+
input = '';
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
remains: input,
|
|
57
|
+
ctrl,
|
|
58
|
+
shift,
|
|
59
|
+
alt,
|
|
60
|
+
meta,
|
|
61
|
+
key
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
static parseChord(input) {
|
|
65
|
+
const mods = this._readModifiers(input);
|
|
66
|
+
const scanCodeMatch = mods.key.match(/^\[([^\]]+)\]$/);
|
|
67
|
+
if (scanCodeMatch) {
|
|
68
|
+
const strScanCode = scanCodeMatch[1];
|
|
69
|
+
const scanCode = ScanCodeUtils.lowerCaseToEnum(strScanCode);
|
|
70
|
+
return [( new ScanCodeChord(mods.ctrl, mods.shift, mods.alt, mods.meta, scanCode)), mods.remains];
|
|
71
|
+
}
|
|
72
|
+
const keyCode = KeyCodeUtils.fromUserSettings(mods.key);
|
|
73
|
+
return [( new KeyCodeChord(mods.ctrl, mods.shift, mods.alt, mods.meta, keyCode)), mods.remains];
|
|
74
|
+
}
|
|
75
|
+
static parseKeybinding(input) {
|
|
76
|
+
if (!input) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const chords = [];
|
|
80
|
+
let chord;
|
|
81
|
+
while (input.length > 0) {
|
|
82
|
+
[chord, input] = this.parseChord(input);
|
|
83
|
+
chords.push(chord);
|
|
84
|
+
}
|
|
85
|
+
return (chords.length > 0 ? ( new Keybinding(chords)) : null);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { KeybindingParser };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import { OS } from 'monaco-editor/esm/vs/base/common/platform.js';
|
|
3
|
+
import { Extensions } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
|
|
4
|
+
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
5
|
+
|
|
6
|
+
function readKeyboardConfig(configurationService) {
|
|
7
|
+
const keyboard = configurationService.getValue('keyboard');
|
|
8
|
+
const dispatch = ((keyboard?.dispatch === 'keyCode' ? 1 : 0) );
|
|
9
|
+
const mapAltGrToCtrlAlt = Boolean(keyboard?.mapAltGrToCtrlAlt);
|
|
10
|
+
return { dispatch, mapAltGrToCtrlAlt };
|
|
11
|
+
}
|
|
12
|
+
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
13
|
+
const keyboardConfiguration = {
|
|
14
|
+
'id': 'keyboard',
|
|
15
|
+
'order': 15,
|
|
16
|
+
'type': 'object',
|
|
17
|
+
'title': ( nls.localizeWithPath(
|
|
18
|
+
'vs/platform/keyboardLayout/common/keyboardConfig',
|
|
19
|
+
'keyboardConfigurationTitle',
|
|
20
|
+
"Keyboard"
|
|
21
|
+
)),
|
|
22
|
+
'properties': {
|
|
23
|
+
'keyboard.dispatch': {
|
|
24
|
+
scope: 1 ,
|
|
25
|
+
type: 'string',
|
|
26
|
+
enum: ['code', 'keyCode'],
|
|
27
|
+
default: 'code',
|
|
28
|
+
markdownDescription: ( nls.localizeWithPath(
|
|
29
|
+
'vs/platform/keyboardLayout/common/keyboardConfig',
|
|
30
|
+
'dispatch',
|
|
31
|
+
"Controls the dispatching logic for key presses to use either `code` (recommended) or `keyCode`."
|
|
32
|
+
)),
|
|
33
|
+
included: OS === 2 || OS === 3
|
|
34
|
+
},
|
|
35
|
+
'keyboard.mapAltGrToCtrlAlt': {
|
|
36
|
+
scope: 1 ,
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
default: false,
|
|
39
|
+
markdownDescription: ( nls.localizeWithPath(
|
|
40
|
+
'vs/platform/keyboardLayout/common/keyboardConfig',
|
|
41
|
+
'mapAltGrToCtrlAlt',
|
|
42
|
+
"Controls if the AltGraph+ modifier should be treated as Ctrl+Alt+."
|
|
43
|
+
)),
|
|
44
|
+
included: OS === 1
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
configurationRegistry.registerConfiguration(keyboardConfiguration);
|
|
49
|
+
|
|
50
|
+
export { readKeyboardConfig };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
class CachedKeyboardMapper {
|
|
2
|
+
constructor(actual) {
|
|
3
|
+
this._actual = actual;
|
|
4
|
+
this._cache = ( new Map());
|
|
5
|
+
}
|
|
6
|
+
dumpDebugInfo() {
|
|
7
|
+
return this._actual.dumpDebugInfo();
|
|
8
|
+
}
|
|
9
|
+
resolveKeyboardEvent(keyboardEvent) {
|
|
10
|
+
return this._actual.resolveKeyboardEvent(keyboardEvent);
|
|
11
|
+
}
|
|
12
|
+
resolveKeybinding(keybinding) {
|
|
13
|
+
const hashCode = keybinding.getHashCode();
|
|
14
|
+
const resolved = this._cache.get(hashCode);
|
|
15
|
+
if (!resolved) {
|
|
16
|
+
const r = this._actual.resolveKeybinding(keybinding);
|
|
17
|
+
this._cache.set(hashCode, r);
|
|
18
|
+
return r;
|
|
19
|
+
}
|
|
20
|
+
return resolved;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { CachedKeyboardMapper };
|