@codingame/monaco-vscode-keybindings-service-override 4.5.0 → 4.5.2
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/index.d.ts +2 -2
- package/package.json +3 -3
- package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +7 -10
- package/vscode/src/vs/workbench/contrib/commands/common/commands.contribution.js +8 -19
- package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +2 -5
- package/vscode/src/vs/workbench/contrib/preferences/browser/keybindingsEditorContribution.js +21 -37
- package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +200 -569
- package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +89 -138
- package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +40 -37
- package/keybindings.d.ts +0 -19
|
@@ -35,6 +35,7 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
35
35
|
})
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
const _moduleId = "vs/workbench/services/keybinding/browser/keyboardLayoutService";
|
|
38
39
|
class BrowserKeyboardMapperFactoryBase extends Disposable {
|
|
39
40
|
get activeKeymap() {
|
|
40
41
|
return this._activeKeymapInfo;
|
|
@@ -55,12 +56,14 @@ class BrowserKeyboardMapperFactoryBase extends Disposable {
|
|
|
55
56
|
return this._activeKeymapInfo?.mapping ?? null;
|
|
56
57
|
}
|
|
57
58
|
get keyboardLayouts() {
|
|
58
|
-
return (
|
|
59
|
+
return (
|
|
60
|
+
(this._keymapInfos.map(keymapInfo => keymapInfo.layout))
|
|
61
|
+
);
|
|
59
62
|
}
|
|
60
63
|
constructor(_configurationService) {
|
|
61
64
|
super();
|
|
62
65
|
this._configurationService = _configurationService;
|
|
63
|
-
this._onDidChangeKeyboardMapper = ( new Emitter());
|
|
66
|
+
this._onDidChangeKeyboardMapper = ( (new Emitter()));
|
|
64
67
|
this.onDidChangeKeyboardMapper = this._onDidChangeKeyboardMapper.event;
|
|
65
68
|
this.keyboardLayoutMapAllowed = navigator.keyboard !== undefined;
|
|
66
69
|
this._keyboardMapper = null;
|
|
@@ -204,12 +207,14 @@ class BrowserKeyboardMapperFactoryBase extends Disposable {
|
|
|
204
207
|
getKeyboardMapper() {
|
|
205
208
|
const config = readKeyboardConfig(this._configurationService);
|
|
206
209
|
if (config.dispatch === 1 || !this._initialized || !this._activeKeymapInfo) {
|
|
207
|
-
return (
|
|
210
|
+
return (
|
|
211
|
+
(new FallbackKeyboardMapper(config.mapAltGrToCtrlAlt, OS))
|
|
212
|
+
);
|
|
208
213
|
}
|
|
209
214
|
if (!this._keyboardMapper) {
|
|
210
|
-
this._keyboardMapper = ( new CachedKeyboardMapper(
|
|
215
|
+
this._keyboardMapper = ( (new CachedKeyboardMapper(
|
|
211
216
|
BrowserKeyboardMapperFactory._createKeyboardMapper(this._activeKeymapInfo, config.mapAltGrToCtrlAlt)
|
|
212
|
-
));
|
|
217
|
+
)));
|
|
213
218
|
}
|
|
214
219
|
return this._keyboardMapper;
|
|
215
220
|
}
|
|
@@ -238,12 +243,18 @@ class BrowserKeyboardMapperFactoryBase extends Disposable {
|
|
|
238
243
|
const rawMapping = keymapInfo.mapping;
|
|
239
244
|
const isUSStandard = !!keymapInfo.layout.isUSStandard;
|
|
240
245
|
if (OS === 1 ) {
|
|
241
|
-
return (
|
|
246
|
+
return (
|
|
247
|
+
(new WindowsKeyboardMapper(isUSStandard, rawMapping, mapAltGrToCtrlAlt))
|
|
248
|
+
);
|
|
242
249
|
}
|
|
243
|
-
if (( Object.keys(rawMapping)).length === 0) {
|
|
244
|
-
return (
|
|
250
|
+
if (( (Object.keys(rawMapping))).length === 0) {
|
|
251
|
+
return (
|
|
252
|
+
(new FallbackKeyboardMapper(mapAltGrToCtrlAlt, OS))
|
|
253
|
+
);
|
|
245
254
|
}
|
|
246
|
-
return (
|
|
255
|
+
return (
|
|
256
|
+
(new MacLinuxKeyboardMapper(isUSStandard, rawMapping, mapAltGrToCtrlAlt, OS))
|
|
257
|
+
);
|
|
247
258
|
}
|
|
248
259
|
_validateCurrentKeyboardMapping(keyboardEvent) {
|
|
249
260
|
if (!this._initialized) {
|
|
@@ -333,12 +344,12 @@ class BrowserKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
|
|
|
333
344
|
const platform = isWindows ? 'win' : isMacintosh ? 'darwin' : 'linux';
|
|
334
345
|
__variableDynamicImportRuntime0__('./keyboardLayouts/layout.contribution.' + platform + '.js').then((m) => {
|
|
335
346
|
const keymapInfos = m.KeyboardLayoutContribution.INSTANCE.layoutInfos;
|
|
336
|
-
this._keymapInfos.push(...( keymapInfos.map(info => (( new KeymapInfo(
|
|
347
|
+
this._keymapInfos.push(...( (keymapInfos.map(info => (( (new KeymapInfo(
|
|
337
348
|
info.layout,
|
|
338
349
|
info.secondaryLayouts,
|
|
339
350
|
info.mapping,
|
|
340
351
|
info.isUserKeyboardLayout
|
|
341
|
-
))))));
|
|
352
|
+
))))))));
|
|
342
353
|
this._mru = this._keymapInfos;
|
|
343
354
|
this._initialized = true;
|
|
344
355
|
this.setLayoutFromBrowserAPI();
|
|
@@ -351,14 +362,14 @@ class UserKeyboardLayout extends Disposable {
|
|
|
351
362
|
super();
|
|
352
363
|
this.keyboardLayoutResource = keyboardLayoutResource;
|
|
353
364
|
this.fileService = fileService;
|
|
354
|
-
this._onDidChange = this._register(( new Emitter()));
|
|
365
|
+
this._onDidChange = this._register(( (new Emitter())));
|
|
355
366
|
this.onDidChange = this._onDidChange.event;
|
|
356
367
|
this._keyboardLayout = null;
|
|
357
|
-
this.reloadConfigurationScheduler = this._register(( new RunOnceScheduler(() => this.reload().then(changed => {
|
|
368
|
+
this.reloadConfigurationScheduler = this._register(( (new RunOnceScheduler(() => this.reload().then(changed => {
|
|
358
369
|
if (changed) {
|
|
359
370
|
this._onDidChange.fire();
|
|
360
371
|
}
|
|
361
|
-
}), 50)));
|
|
372
|
+
}), 50))));
|
|
362
373
|
this._register(Event.filter(this.fileService.onDidFilesChange, e => e.contains(this.keyboardLayoutResource))(() => this.reloadConfigurationScheduler.schedule()));
|
|
363
374
|
}
|
|
364
375
|
async initialize() {
|
|
@@ -368,7 +379,7 @@ class UserKeyboardLayout extends Disposable {
|
|
|
368
379
|
const existing = this._keyboardLayout;
|
|
369
380
|
try {
|
|
370
381
|
const content = await this.fileService.readFile(this.keyboardLayoutResource);
|
|
371
|
-
const value = parse(( content.value.toString()));
|
|
382
|
+
const value = parse(( (content.value.toString())));
|
|
372
383
|
if (getNodeType(value) === 'object') {
|
|
373
384
|
const layoutInfo = value.layout;
|
|
374
385
|
const mappings = value.rawMapping;
|
|
@@ -388,12 +399,12 @@ let BrowserKeyboardLayoutService = class BrowserKeyboardLayoutService extends Di
|
|
|
388
399
|
constructor(environmentService, fileService, notificationService, storageService, commandService, configurationService) {
|
|
389
400
|
super();
|
|
390
401
|
this.configurationService = configurationService;
|
|
391
|
-
this._onDidChangeKeyboardLayout = ( new Emitter());
|
|
402
|
+
this._onDidChangeKeyboardLayout = ( (new Emitter()));
|
|
392
403
|
this.onDidChangeKeyboardLayout = this._onDidChangeKeyboardLayout.event;
|
|
393
404
|
const keyboardConfig = configurationService.getValue('keyboard');
|
|
394
405
|
const layout = keyboardConfig.layout;
|
|
395
406
|
this._keyboardLayoutMode = layout ?? 'autodetect';
|
|
396
|
-
this._factory = ( new BrowserKeyboardMapperFactory(configurationService, notificationService, storageService, commandService));
|
|
407
|
+
this._factory = ( (new BrowserKeyboardMapperFactory(configurationService, notificationService, storageService, commandService)));
|
|
397
408
|
this._register(this._factory.onDidChangeKeyboardMapper(() => {
|
|
398
409
|
this._onDidChangeKeyboardLayout.fire();
|
|
399
410
|
}));
|
|
@@ -413,7 +424,7 @@ let BrowserKeyboardLayoutService = class BrowserKeyboardLayoutService extends Di
|
|
|
413
424
|
}
|
|
414
425
|
}
|
|
415
426
|
}));
|
|
416
|
-
this._userKeyboardLayout = ( new UserKeyboardLayout(environmentService.keyboardLayoutResource, fileService));
|
|
427
|
+
this._userKeyboardLayout = ( (new UserKeyboardLayout(environmentService.keyboardLayoutResource, fileService)));
|
|
417
428
|
this._userKeyboardLayout.initialize().then(() => {
|
|
418
429
|
if (this._userKeyboardLayout.keyboardLayout) {
|
|
419
430
|
this._factory.registerKeyboardLayout(this._userKeyboardLayout.keyboardLayout);
|
|
@@ -468,33 +479,25 @@ let BrowserKeyboardLayoutService = class BrowserKeyboardLayoutService extends Di
|
|
|
468
479
|
this._factory.validateCurrentKeyboardMapping(keyboardEvent);
|
|
469
480
|
}
|
|
470
481
|
};
|
|
471
|
-
BrowserKeyboardLayoutService = ( __decorate([
|
|
472
|
-
( __param(0, IEnvironmentService)),
|
|
473
|
-
( __param(1, IFileService)),
|
|
474
|
-
( __param(2, INotificationService)),
|
|
475
|
-
( __param(3, IStorageService)),
|
|
476
|
-
( __param(4, ICommandService)),
|
|
477
|
-
( __param(5, IConfigurationService))
|
|
478
|
-
], BrowserKeyboardLayoutService));
|
|
479
|
-
const configurationRegistry = ( Registry.as(Extensions.Configuration));
|
|
482
|
+
BrowserKeyboardLayoutService = ( (__decorate([
|
|
483
|
+
( (__param(0, IEnvironmentService))),
|
|
484
|
+
( (__param(1, IFileService))),
|
|
485
|
+
( (__param(2, INotificationService))),
|
|
486
|
+
( (__param(3, IStorageService))),
|
|
487
|
+
( (__param(4, ICommandService))),
|
|
488
|
+
( (__param(5, IConfigurationService)))
|
|
489
|
+
], BrowserKeyboardLayoutService)));
|
|
490
|
+
const configurationRegistry = ( (Registry.as(Extensions.Configuration)));
|
|
480
491
|
const keyboardConfiguration = {
|
|
481
492
|
'id': 'keyboard',
|
|
482
493
|
'order': 15,
|
|
483
494
|
'type': 'object',
|
|
484
|
-
'title': ( localizeWithPath(
|
|
485
|
-
'vs/workbench/services/keybinding/browser/keyboardLayoutService',
|
|
486
|
-
'keyboardConfigurationTitle',
|
|
487
|
-
"Keyboard"
|
|
488
|
-
)),
|
|
495
|
+
'title': ( localizeWithPath(_moduleId, 0, "Keyboard")),
|
|
489
496
|
'properties': {
|
|
490
497
|
'keyboard.layout': {
|
|
491
498
|
'type': 'string',
|
|
492
499
|
'default': 'autodetect',
|
|
493
|
-
'description': ( localizeWithPath(
|
|
494
|
-
'vs/workbench/services/keybinding/browser/keyboardLayoutService',
|
|
495
|
-
'keyboard.layout.config',
|
|
496
|
-
"Control the keyboard layout used in web."
|
|
497
|
-
))
|
|
500
|
+
'description': ( localizeWithPath(_moduleId, 1, "Control the keyboard layout used in web."))
|
|
498
501
|
}
|
|
499
502
|
}
|
|
500
503
|
};
|
package/keybindings.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
|
|
2
|
-
import { IFileWriteOptions } from 'vscode/vscode/vs/platform/files/common/files';
|
|
3
|
-
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
4
|
-
|
|
5
|
-
declare const defaultUserKeybindindsFile: URI;
|
|
6
|
-
/**
|
|
7
|
-
* Should be called only BEFORE the service are initialized to initialize the file on the filesystem before the keybindings service initializes
|
|
8
|
-
*/
|
|
9
|
-
declare function initUserKeybindings(configurationJson: string, options?: Partial<IFileWriteOptions>, file?: URI): Promise<void>;
|
|
10
|
-
/**
|
|
11
|
-
* Can be called at any time after the services are initialized to update the user configuration
|
|
12
|
-
*/
|
|
13
|
-
declare function updateUserKeybindings(keybindingsJson: string): Promise<void>;
|
|
14
|
-
interface KeybindingsProps {
|
|
15
|
-
shouldUseGlobalKeybindings?: () => boolean;
|
|
16
|
-
}
|
|
17
|
-
declare function getServiceOverride({ shouldUseGlobalKeybindings }?: KeybindingsProps): IEditorOverrideServices;
|
|
18
|
-
|
|
19
|
-
export { getServiceOverride as default, defaultUserKeybindindsFile, initUserKeybindings, updateUserKeybindings };
|