@theia/monaco 1.46.1 → 1.47.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/lib/browser/index.js +2 -11
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +0 -4
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts.map +1 -1
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +18 -41
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js.map +1 -1
- package/lib/browser/monaco-bulk-edit-service.d.ts +1 -3
- package/lib/browser/monaco-bulk-edit-service.d.ts.map +1 -1
- package/lib/browser/monaco-bulk-edit-service.js +5 -13
- package/lib/browser/monaco-bulk-edit-service.js.map +1 -1
- package/lib/browser/monaco-color-registry.js +2 -7
- package/lib/browser/monaco-color-registry.js.map +1 -1
- package/lib/browser/monaco-command-registry.d.ts +1 -1
- package/lib/browser/monaco-command-registry.d.ts.map +1 -1
- package/lib/browser/monaco-command-registry.js +11 -16
- package/lib/browser/monaco-command-registry.js.map +1 -1
- package/lib/browser/monaco-command-service.d.ts +1 -6
- package/lib/browser/monaco-command-service.d.ts.map +1 -1
- package/lib/browser/monaco-command-service.js +20 -30
- package/lib/browser/monaco-command-service.js.map +1 -1
- package/lib/browser/monaco-command.d.ts +0 -6
- package/lib/browser/monaco-command.d.ts.map +1 -1
- package/lib/browser/monaco-command.js +19 -40
- package/lib/browser/monaco-command.js.map +1 -1
- package/lib/browser/monaco-context-key-service.d.ts +2 -2
- package/lib/browser/monaco-context-key-service.d.ts.map +1 -1
- package/lib/browser/monaco-context-key-service.js +11 -20
- package/lib/browser/monaco-context-key-service.js.map +1 -1
- package/lib/browser/monaco-context-menu.d.ts +4 -3
- package/lib/browser/monaco-context-menu.d.ts.map +1 -1
- package/lib/browser/monaco-context-menu.js +21 -19
- package/lib/browser/monaco-context-menu.js.map +1 -1
- package/lib/browser/monaco-diff-editor.d.ts +3 -3
- package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
- package/lib/browser/monaco-diff-editor.js +2 -2
- package/lib/browser/monaco-diff-editor.js.map +1 -1
- package/lib/browser/monaco-diff-navigator-factory.d.ts +2 -3
- package/lib/browser/monaco-diff-navigator-factory.d.ts.map +1 -1
- package/lib/browser/monaco-diff-navigator-factory.js +7 -33
- package/lib/browser/monaco-diff-navigator-factory.js.map +1 -1
- package/lib/browser/monaco-editor-model.d.ts +4 -2
- package/lib/browser/monaco-editor-model.d.ts.map +1 -1
- package/lib/browser/monaco-editor-model.js +4 -1
- package/lib/browser/monaco-editor-model.js.map +1 -1
- package/lib/browser/monaco-editor-provider.d.ts +3 -20
- package/lib/browser/monaco-editor-provider.d.ts.map +1 -1
- package/lib/browser/monaco-editor-provider.js +37 -95
- package/lib/browser/monaco-editor-provider.js.map +1 -1
- package/lib/browser/monaco-editor-service.d.ts +7 -2
- package/lib/browser/monaco-editor-service.d.ts.map +1 -1
- package/lib/browser/monaco-editor-service.js +23 -31
- package/lib/browser/monaco-editor-service.js.map +1 -1
- package/lib/browser/monaco-editor.d.ts +4 -1
- package/lib/browser/monaco-editor.d.ts.map +1 -1
- package/lib/browser/monaco-editor.js +33 -26
- package/lib/browser/monaco-editor.js.map +1 -1
- package/lib/browser/monaco-formatting-conflicts.js +10 -18
- package/lib/browser/monaco-formatting-conflicts.js.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.d.ts +0 -6
- package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.js +18 -63
- package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
- package/lib/browser/monaco-frontend-module.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-module.js +17 -8
- package/lib/browser/monaco-frontend-module.js.map +1 -1
- package/lib/browser/monaco-gotoline-quick-access.js +5 -16
- package/lib/browser/monaco-gotoline-quick-access.js.map +1 -1
- package/lib/browser/monaco-gotosymbol-quick-access.js +7 -18
- package/lib/browser/monaco-gotosymbol-quick-access.js.map +1 -1
- package/lib/browser/monaco-icon-registry.d.ts +1 -2
- package/lib/browser/monaco-icon-registry.d.ts.map +1 -1
- package/lib/browser/monaco-icon-registry.js +4 -7
- package/lib/browser/monaco-icon-registry.js.map +1 -1
- package/lib/browser/monaco-indexed-db.js +2 -7
- package/lib/browser/monaco-indexed-db.js.map +1 -1
- package/lib/browser/monaco-init.d.ts +5 -0
- package/lib/browser/monaco-init.d.ts.map +1 -0
- package/lib/browser/monaco-init.js +114 -0
- package/lib/browser/monaco-init.js.map +1 -0
- package/lib/browser/monaco-keybinding.js +17 -25
- package/lib/browser/monaco-keybinding.js.map +1 -1
- package/lib/browser/monaco-keycode-map.js +37 -37
- package/lib/browser/monaco-keycode-map.js.map +1 -1
- package/lib/browser/monaco-languages.js +10 -18
- package/lib/browser/monaco-languages.js.map +1 -1
- package/lib/browser/monaco-menu.js +4 -15
- package/lib/browser/monaco-menu.js.map +1 -1
- package/lib/browser/monaco-mime-service.js +3 -11
- package/lib/browser/monaco-mime-service.js.map +1 -1
- package/lib/browser/monaco-outline-contribution.js +6 -14
- package/lib/browser/monaco-outline-contribution.js.map +1 -1
- package/lib/browser/monaco-outline-decorator.js +2 -7
- package/lib/browser/monaco-outline-decorator.js.map +1 -1
- package/lib/browser/monaco-quick-access-registry.js +4 -12
- package/lib/browser/monaco-quick-access-registry.js.map +1 -1
- package/lib/browser/monaco-quick-input-service.d.ts +7 -9
- package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
- package/lib/browser/monaco-quick-input-service.js +76 -123
- package/lib/browser/monaco-quick-input-service.js.map +1 -1
- package/lib/browser/monaco-resolved-keybinding.d.ts +10 -10
- package/lib/browser/monaco-resolved-keybinding.d.ts.map +1 -1
- package/lib/browser/monaco-resolved-keybinding.js +16 -16
- package/lib/browser/monaco-resolved-keybinding.js.map +1 -1
- package/lib/browser/monaco-snippet-suggest-provider.js +4 -12
- package/lib/browser/monaco-snippet-suggest-provider.js.map +1 -1
- package/lib/browser/monaco-status-bar-contribution.js +5 -16
- package/lib/browser/monaco-status-bar-contribution.js.map +1 -1
- package/lib/browser/monaco-text-model-service.js +21 -29
- package/lib/browser/monaco-text-model-service.js.map +1 -1
- package/lib/browser/monaco-theming-service.js +8 -16
- package/lib/browser/monaco-theming-service.js.map +1 -1
- package/lib/browser/monaco-to-protocol-converter.js +2 -7
- package/lib/browser/monaco-to-protocol-converter.js.map +1 -1
- package/lib/browser/monaco-workspace.d.ts +1 -3
- package/lib/browser/monaco-workspace.d.ts.map +1 -1
- package/lib/browser/monaco-workspace.js +27 -35
- package/lib/browser/monaco-workspace.js.map +1 -1
- package/lib/browser/protocol-to-monaco-converter.js +2 -7
- package/lib/browser/protocol-to-monaco-converter.js.map +1 -1
- package/lib/browser/simple-monaco-editor.d.ts +1 -0
- package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
- package/lib/browser/simple-monaco-editor.js +10 -2
- package/lib/browser/simple-monaco-editor.js.map +1 -1
- package/lib/browser/textmate/index.js +5 -14
- package/lib/browser/textmate/index.js.map +1 -1
- package/lib/browser/textmate/monaco-textmate-service.js +19 -27
- package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
- package/lib/browser/textmate/monaco-theme-registry.js +4 -12
- package/lib/browser/textmate/monaco-theme-registry.js.map +1 -1
- package/lib/browser/textmate/textmate-registry.js +2 -7
- package/lib/browser/textmate/textmate-registry.js.map +1 -1
- package/lib/browser/workspace-symbol-command.js +14 -22
- package/lib/browser/workspace-symbol-command.js.map +1 -1
- package/package.json +11 -10
- package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +10 -18
- package/src/browser/monaco-bulk-edit-service.ts +2 -2
- package/src/browser/monaco-command-registry.ts +4 -1
- package/src/browser/monaco-command-service.ts +16 -25
- package/src/browser/monaco-command.ts +5 -15
- package/src/browser/monaco-context-key-service.ts +7 -6
- package/src/browser/monaco-context-menu.ts +13 -3
- package/src/browser/monaco-diff-editor.ts +8 -9
- package/src/browser/monaco-diff-navigator-factory.ts +6 -28
- package/src/browser/monaco-editor-model.ts +6 -3
- package/src/browser/monaco-editor-provider.ts +25 -59
- package/src/browser/monaco-editor-service.ts +10 -5
- package/src/browser/monaco-editor.ts +28 -9
- package/src/browser/monaco-frontend-application-contribution.ts +0 -35
- package/src/browser/monaco-frontend-module.ts +25 -17
- package/src/browser/monaco-icon-registry.ts +6 -4
- package/src/browser/monaco-init.ts +114 -0
- package/src/browser/monaco-keybinding.ts +3 -3
- package/src/browser/monaco-quick-input-service.ts +79 -108
- package/src/browser/monaco-resolved-keybinding.ts +23 -23
- package/src/browser/monaco-text-model-service.ts +1 -1
- package/src/browser/monaco-workspace.ts +10 -10
- package/src/browser/simple-monaco-editor.ts +9 -2
- package/src/browser/textmate/monaco-textmate-service.ts +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 STMicroelectronics and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* The code in this file is responsible for overriding service implementations in the Monaco editor with our own Theia-based implementations.
|
|
19
|
+
* Since we only get a single chance to call `StandaloneServies.initialize()` with our overrides, we need to make sure that intialize is called before the first call to
|
|
20
|
+
* `StandaloneServices.get()` or `StandaloneServies.initialize()`. As we do not control the mechanics of Inversify instance constructions, the approach here is to call
|
|
21
|
+
* `MonacoInit.init()` from the `index.js` file after all container modules are loaded, but before the first object is fetched from it.
|
|
22
|
+
* `StandaloneServices.initialize()` is called with service descriptors, not service instances. This lets us finish all overrides before any inversify object is constructed and
|
|
23
|
+
* might call `initialize()` while being constructed.
|
|
24
|
+
* The service descriptors require a constructor function, so we declare dummy class for each Monaco service we override. But instead of returning an instance of the dummy class,
|
|
25
|
+
* we fetch the implementation of the monaco service from the inversify container.
|
|
26
|
+
* The inversify-constructed services must not call StandaloneServices.get() or StandaloneServices.initialize() from their constructors. Calling `get`()` in postConstruct mehtods
|
|
27
|
+
* is allowed.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { Container } from '@theia/core/shared/inversify';
|
|
31
|
+
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
32
|
+
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
33
|
+
import { SyncDescriptor } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/descriptors';
|
|
34
|
+
import { MonacoEditorServiceFactory, MonacoEditorServiceFactoryType } from './monaco-editor-service';
|
|
35
|
+
import { IConfigurationService } from '@theia/monaco-editor-core/esm/vs/platform/configuration/common/configuration';
|
|
36
|
+
import { ITextModelService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/resolverService';
|
|
37
|
+
import { MonacoConfigurationService } from './monaco-frontend-module';
|
|
38
|
+
import { MonacoTextModelService } from './monaco-text-model-service';
|
|
39
|
+
import { MonacoContextMenuService } from './monaco-context-menu';
|
|
40
|
+
import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView';
|
|
41
|
+
import { IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
42
|
+
import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
|
|
43
|
+
import { MonacoBulkEditService } from './monaco-bulk-edit-service';
|
|
44
|
+
import { MonacoCommandService } from './monaco-command-service';
|
|
45
|
+
import { IBulkEditService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService';
|
|
46
|
+
import { ICommandService } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands';
|
|
47
|
+
import { MonacoQuickInputImplementation } from './monaco-quick-input-service';
|
|
48
|
+
import { IQuickInputService } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickInput';
|
|
49
|
+
|
|
50
|
+
class MonacoEditorServiceConstructor {
|
|
51
|
+
/**
|
|
52
|
+
* MonacoEditorService needs other Monaco services as constructor parameters, so we need to do use a factory for constructing the service. If we want the singleton instance,
|
|
53
|
+
* we need to fetch it from the `StandaloneServices` class instead of injecting it.
|
|
54
|
+
* @param container
|
|
55
|
+
* @param contextKeyService
|
|
56
|
+
* @param themeService
|
|
57
|
+
*/
|
|
58
|
+
constructor(container: Container,
|
|
59
|
+
@IContextKeyService contextKeyService: IContextKeyService,
|
|
60
|
+
@IThemeService themeService: IThemeService) {
|
|
61
|
+
|
|
62
|
+
return container.get<MonacoEditorServiceFactoryType>(MonacoEditorServiceFactory)(contextKeyService, themeService);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class MonacoConfigurationServiceConstructor {
|
|
67
|
+
constructor(container: Container) {
|
|
68
|
+
return container.get(MonacoConfigurationService);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
class MonacoTextModelServiceConstructor {
|
|
73
|
+
constructor(container: Container) {
|
|
74
|
+
return container.get(MonacoTextModelService);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
class MonacoContextMenuServiceConstructor {
|
|
79
|
+
constructor(container: Container) {
|
|
80
|
+
return container.get(MonacoContextMenuService);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
class MonacoBulkEditServiceConstructor {
|
|
85
|
+
constructor(container: Container) {
|
|
86
|
+
return container.get(MonacoBulkEditService);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
class MonacoCommandServiceConstructor {
|
|
91
|
+
constructor(container: Container) {
|
|
92
|
+
return container.get(MonacoCommandService);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
class MonacoQuickInputImplementationConstructor {
|
|
97
|
+
constructor(container: Container) {
|
|
98
|
+
return container.get(MonacoQuickInputImplementation);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export namespace MonacoInit {
|
|
103
|
+
export function init(container: Container): void {
|
|
104
|
+
StandaloneServices.initialize({
|
|
105
|
+
[ICodeEditorService.toString()]: new SyncDescriptor(MonacoEditorServiceConstructor, [container]),
|
|
106
|
+
[IConfigurationService.toString()]: new SyncDescriptor(MonacoConfigurationServiceConstructor, [container]),
|
|
107
|
+
[ITextModelService.toString()]: new SyncDescriptor(MonacoTextModelServiceConstructor, [container]),
|
|
108
|
+
[IContextMenuService.toString()]: new SyncDescriptor(MonacoContextMenuServiceConstructor, [container]),
|
|
109
|
+
[IBulkEditService.toString()]: new SyncDescriptor(MonacoBulkEditServiceConstructor, [container]),
|
|
110
|
+
[ICommandService.toString()]: new SyncDescriptor(MonacoCommandServiceConstructor, [container]),
|
|
111
|
+
[IQuickInputService.toString()]: new SyncDescriptor(MonacoQuickInputImplementationConstructor, [container]),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -45,14 +45,14 @@ export class MonacoKeybindingContribution implements KeybindingContribution {
|
|
|
45
45
|
registerKeybindings(registry: KeybindingRegistry): void {
|
|
46
46
|
const defaultKeybindings = KeybindingsRegistry.getDefaultKeybindings();
|
|
47
47
|
for (const item of defaultKeybindings) {
|
|
48
|
-
const command = this.commands.validate(item.command);
|
|
49
|
-
if (command) {
|
|
48
|
+
const command = this.commands.validate(item.command || undefined);
|
|
49
|
+
if (command && item.keybinding) {
|
|
50
50
|
const when = (item.when && item.when.serialize()) ?? undefined;
|
|
51
51
|
let keybinding;
|
|
52
52
|
if (item.command === MonacoCommands.GO_TO_DEFINITION && !environment.electron.is()) {
|
|
53
53
|
keybinding = 'ctrlcmd+f11';
|
|
54
54
|
} else {
|
|
55
|
-
keybinding = MonacoResolvedKeybinding.toKeybinding(item.keybinding);
|
|
55
|
+
keybinding = MonacoResolvedKeybinding.toKeybinding(item.keybinding.chords);
|
|
56
56
|
}
|
|
57
57
|
registry.registerKeybinding({ command, keybinding, when });
|
|
58
58
|
}
|
|
@@ -16,21 +16,21 @@
|
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
ApplicationShell,
|
|
19
|
-
InputBox, InputOptions, KeybindingRegistry,
|
|
19
|
+
InputBox, InputOptions, KeybindingRegistry, PickOptions,
|
|
20
20
|
QuickInputButton, QuickInputHideReason, QuickInputService, QuickPick, QuickPickItem,
|
|
21
|
-
QuickPickItemButtonEvent, QuickPickItemHighlights, QuickPickOptions, QuickPickSeparator
|
|
21
|
+
QuickPickItemButtonEvent, QuickPickItemHighlights, QuickPickOptions, QuickPickSeparator
|
|
22
22
|
} from '@theia/core/lib/browser';
|
|
23
23
|
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
24
24
|
import {
|
|
25
25
|
IInputBox, IInputOptions, IKeyMods, IPickOptions, IQuickInput, IQuickInputButton,
|
|
26
|
-
IQuickInputService, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, IQuickPickItemButtonEvent, IQuickPickSeparator, QuickPickInput
|
|
26
|
+
IQuickInputService, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, IQuickPickItemButtonEvent, IQuickPickSeparator, IQuickWidget, QuickPickInput
|
|
27
27
|
} from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickInput';
|
|
28
|
-
import { IQuickInputOptions, IQuickInputStyles
|
|
28
|
+
import { IQuickInputOptions, IQuickInputStyles } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/browser/quickInput';
|
|
29
|
+
import { QuickInputController } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/browser/quickInputController';
|
|
29
30
|
import { MonacoResolvedKeybinding } from './monaco-resolved-keybinding';
|
|
30
31
|
import { IQuickAccessController } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess';
|
|
31
32
|
import { QuickAccessController } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/browser/quickAccess';
|
|
32
|
-
import {
|
|
33
|
-
import { IContextKey } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
33
|
+
import { IContextKey, IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
34
34
|
import { IListOptions, List } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/list/listWidget';
|
|
35
35
|
import * as monaco from '@theia/monaco-editor-core';
|
|
36
36
|
import { ResolvedKeybinding } from '@theia/monaco-editor-core/esm/vs/base/common/keybindings';
|
|
@@ -38,11 +38,18 @@ import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform
|
|
|
38
38
|
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
39
39
|
import { IMatch } from '@theia/monaco-editor-core/esm/vs/base/common/filters';
|
|
40
40
|
import { IListRenderer, IListVirtualDelegate } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/list/list';
|
|
41
|
-
import { Event } from '@theia/core';
|
|
41
|
+
import { CancellationToken, Event } from '@theia/core';
|
|
42
42
|
import { MonacoColorRegistry } from './monaco-color-registry';
|
|
43
43
|
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
44
44
|
import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
45
|
-
import {
|
|
45
|
+
import {
|
|
46
|
+
activeContrastBorder, asCssVariable, pickerGroupBorder, pickerGroupForeground, quickInputBackground, quickInputForeground, quickInputListFocusBackground,
|
|
47
|
+
quickInputListFocusForeground, quickInputListFocusIconForeground, quickInputTitleBackground, widgetBorder, widgetShadow
|
|
48
|
+
} from '@theia/monaco-editor-core/esm/vs/platform/theme/common/colorRegistry';
|
|
49
|
+
|
|
50
|
+
import {
|
|
51
|
+
defaultButtonStyles, defaultCountBadgeStyles, defaultInputBoxStyles, defaultKeybindingLabelStyles, defaultProgressBarStyles, defaultToggleStyles, getListStyles
|
|
52
|
+
} from '@theia/monaco-editor-core/esm/vs/platform/theme/browser/defaultStyles';
|
|
46
53
|
|
|
47
54
|
// Copied from @vscode/src/vs/base/parts/quickInput/browser/quickInputList.ts
|
|
48
55
|
export interface IListElement {
|
|
@@ -62,6 +69,7 @@ export interface IListElement {
|
|
|
62
69
|
|
|
63
70
|
@injectable()
|
|
64
71
|
export class MonacoQuickInputImplementation implements IQuickInputService {
|
|
72
|
+
|
|
65
73
|
declare readonly _serviceBrand: undefined;
|
|
66
74
|
|
|
67
75
|
controller: QuickInputController;
|
|
@@ -76,9 +84,6 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
|
|
|
76
84
|
@inject(ThemeService)
|
|
77
85
|
protected readonly themeService: ThemeService;
|
|
78
86
|
|
|
79
|
-
@inject(VSCodeContextKeyService)
|
|
80
|
-
protected readonly contextKeyService: VSCodeContextKeyService;
|
|
81
|
-
|
|
82
87
|
protected container: HTMLElement;
|
|
83
88
|
private quickInputList: List<unknown>;
|
|
84
89
|
|
|
@@ -93,25 +98,29 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
|
|
|
93
98
|
this.initContainer();
|
|
94
99
|
this.initController();
|
|
95
100
|
this.quickAccess = new QuickAccessController(this, StandaloneServices.get(IInstantiationService));
|
|
96
|
-
this.inQuickOpen =
|
|
101
|
+
this.inQuickOpen = StandaloneServices.get(IContextKeyService).createKey<boolean>('inQuickOpen', false);
|
|
97
102
|
this.controller.onShow(() => {
|
|
98
103
|
this.container.style.top = this.shell.mainPanel.node.getBoundingClientRect().top + 'px';
|
|
99
104
|
this.inQuickOpen.set(true);
|
|
100
105
|
});
|
|
101
106
|
this.controller.onHide(() => this.inQuickOpen.set(false));
|
|
102
107
|
|
|
103
|
-
this.themeService.initialized.then(() => this.controller.applyStyles(this.
|
|
108
|
+
this.themeService.initialized.then(() => this.controller.applyStyles(this.computeStyles()));
|
|
104
109
|
// Hook into the theming service of Monaco to ensure that the updates are ready.
|
|
105
|
-
StandaloneServices.get(IStandaloneThemeService).onDidColorThemeChange(() => this.controller.applyStyles(this.
|
|
110
|
+
StandaloneServices.get(IStandaloneThemeService).onDidColorThemeChange(() => this.controller.applyStyles(this.computeStyles()));
|
|
106
111
|
window.addEventListener('resize', () => this.updateLayout());
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
setContextKey(key: string | undefined): void {
|
|
110
115
|
if (key) {
|
|
111
|
-
|
|
116
|
+
StandaloneServices.get(IContextKeyService).createKey<string>(key, undefined);
|
|
112
117
|
}
|
|
113
118
|
}
|
|
114
119
|
|
|
120
|
+
createQuickWidget(): IQuickWidget {
|
|
121
|
+
return this.controller.createQuickWidget();
|
|
122
|
+
}
|
|
123
|
+
|
|
115
124
|
createQuickPick<T extends IQuickPickItem>(): IQuickPick<T> {
|
|
116
125
|
return this.controller.createQuickPick<T>();
|
|
117
126
|
}
|
|
@@ -184,7 +193,7 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
|
|
|
184
193
|
}
|
|
185
194
|
|
|
186
195
|
private initController(): void {
|
|
187
|
-
this.controller = new QuickInputController(this.getOptions());
|
|
196
|
+
this.controller = new QuickInputController(this.getOptions(), StandaloneServices.get(IStandaloneThemeService));
|
|
188
197
|
this.updateLayout();
|
|
189
198
|
}
|
|
190
199
|
|
|
@@ -202,73 +211,53 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
|
|
|
202
211
|
const options: IQuickInputOptions = {
|
|
203
212
|
idPrefix: 'quickInput_',
|
|
204
213
|
container: this.container,
|
|
205
|
-
styles:
|
|
214
|
+
styles: this.computeStyles(),
|
|
206
215
|
ignoreFocusOut: () => false,
|
|
207
|
-
isScreenReaderOptimized: () => false, // TODO change to true once support is added.
|
|
208
216
|
backKeybindingLabel: () => undefined,
|
|
209
217
|
setContextKey: (id?: string) => this.setContextKey(id),
|
|
210
218
|
returnFocus: () => this.container.focus(),
|
|
211
219
|
createList: <T>(
|
|
212
220
|
user: string, container: HTMLElement, delegate: IListVirtualDelegate<T>, renderers: IListRenderer<T, unknown>[], listOptions: IListOptions<T>
|
|
213
221
|
): List<T> => this.quickInputList = new List(user, container, delegate, renderers, listOptions),
|
|
222
|
+
linkOpenerDelegate: () => {
|
|
223
|
+
// @monaco-uplift: not sure what to do here
|
|
224
|
+
}
|
|
214
225
|
};
|
|
215
226
|
return options;
|
|
216
227
|
}
|
|
217
228
|
|
|
218
229
|
// @monaco-uplift
|
|
219
230
|
// Keep the styles up to date with https://github.com/microsoft/vscode/blob/7888ff3a6b104e9e2e3d0f7890ca92dd0828215f/src/vs/platform/quickinput/browser/quickInput.ts#L171.
|
|
220
|
-
private
|
|
231
|
+
private computeStyles(): IQuickInputStyles {
|
|
221
232
|
return {
|
|
222
233
|
widget: {
|
|
223
|
-
quickInputBackground:
|
|
224
|
-
quickInputForeground:
|
|
225
|
-
quickInputTitleBackground:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
listBackground: this.colorRegistry.getColor('quickInput.background'),
|
|
229
|
-
listInactiveFocusForeground: this.colorRegistry.getColor('quickInputList.focusForeground'),
|
|
230
|
-
listInactiveSelectionIconForeground: this.colorRegistry.getColor('quickInputList.focusIconForeground'),
|
|
231
|
-
listInactiveFocusBackground: this.colorRegistry.getColor('quickInputList.focusBackground'),
|
|
232
|
-
listFocusOutline: this.colorRegistry.getColor('activeContrastBorder'),
|
|
233
|
-
listInactiveFocusOutline: this.colorRegistry.getColor('activeContrastBorder'),
|
|
234
|
-
pickerGroupBorder: this.colorRegistry.getColor('pickerGroup.border'),
|
|
235
|
-
pickerGroupForeground: this.colorRegistry.getColor('pickerGroup.foreground')
|
|
236
|
-
},
|
|
237
|
-
inputBox: {
|
|
238
|
-
inputForeground: this.colorRegistry.getColor('inputForeground'),
|
|
239
|
-
inputBackground: this.colorRegistry.getColor('inputBackground'),
|
|
240
|
-
inputBorder: this.colorRegistry.getColor('inputBorder'),
|
|
241
|
-
inputValidationInfoBackground: this.colorRegistry.getColor('inputValidation.infoBackground'),
|
|
242
|
-
inputValidationInfoForeground: this.colorRegistry.getColor('inputValidation.infoForeground'),
|
|
243
|
-
inputValidationInfoBorder: this.colorRegistry.getColor('inputValidation.infoBorder'),
|
|
244
|
-
inputValidationWarningBackground: this.colorRegistry.getColor('inputValidation.warningBackground'),
|
|
245
|
-
inputValidationWarningForeground: this.colorRegistry.getColor('inputValidation.warningForeground'),
|
|
246
|
-
inputValidationWarningBorder: this.colorRegistry.getColor('inputValidation.warningBorder'),
|
|
247
|
-
inputValidationErrorBackground: this.colorRegistry.getColor('inputValidation.errorBackground'),
|
|
248
|
-
inputValidationErrorForeground: this.colorRegistry.getColor('inputValidation.errorForeground'),
|
|
249
|
-
inputValidationErrorBorder: this.colorRegistry.getColor('inputValidation.errorBorder'),
|
|
250
|
-
},
|
|
251
|
-
countBadge: {
|
|
252
|
-
badgeBackground: this.colorRegistry.getColor('badge.background'),
|
|
253
|
-
badgeForeground: this.colorRegistry.getColor('badge.foreground'),
|
|
254
|
-
badgeBorder: this.colorRegistry.getColor('contrastBorder')
|
|
255
|
-
},
|
|
256
|
-
button: {
|
|
257
|
-
buttonForeground: this.colorRegistry.getColor('button.foreground'),
|
|
258
|
-
buttonBackground: this.colorRegistry.getColor('button.background'),
|
|
259
|
-
buttonHoverBackground: this.colorRegistry.getColor('button.hoverBackground'),
|
|
260
|
-
buttonBorder: this.colorRegistry.getColor('contrastBorder')
|
|
261
|
-
},
|
|
262
|
-
progressBar: {
|
|
263
|
-
progressBarBackground: this.colorRegistry.getColor('progressBar.background')
|
|
264
|
-
},
|
|
265
|
-
keybindingLabel: {
|
|
266
|
-
keybindingLabelBackground: this.colorRegistry.getColor('keybindingLabe.background'),
|
|
267
|
-
keybindingLabelForeground: this.colorRegistry.getColor('keybindingLabel.foreground'),
|
|
268
|
-
keybindingLabelBorder: this.colorRegistry.getColor('keybindingLabel.border'),
|
|
269
|
-
keybindingLabelBottomBorder: this.colorRegistry.getColor('keybindingLabel.bottomBorder'),
|
|
270
|
-
keybindingLabelShadow: this.colorRegistry.getColor('widget.shadow')
|
|
234
|
+
quickInputBackground: asCssVariable(quickInputBackground),
|
|
235
|
+
quickInputForeground: asCssVariable(quickInputForeground),
|
|
236
|
+
quickInputTitleBackground: asCssVariable(quickInputTitleBackground),
|
|
237
|
+
widgetBorder: asCssVariable(widgetBorder),
|
|
238
|
+
widgetShadow: asCssVariable(widgetShadow),
|
|
271
239
|
},
|
|
240
|
+
inputBox: defaultInputBoxStyles,
|
|
241
|
+
toggle: defaultToggleStyles,
|
|
242
|
+
countBadge: defaultCountBadgeStyles,
|
|
243
|
+
button: defaultButtonStyles,
|
|
244
|
+
progressBar: defaultProgressBarStyles,
|
|
245
|
+
keybindingLabel: defaultKeybindingLabelStyles,
|
|
246
|
+
list: getListStyles({
|
|
247
|
+
listBackground: quickInputBackground,
|
|
248
|
+
listFocusBackground: quickInputListFocusBackground,
|
|
249
|
+
listFocusForeground: quickInputListFocusForeground,
|
|
250
|
+
// Look like focused when inactive.
|
|
251
|
+
listInactiveFocusForeground: quickInputListFocusForeground,
|
|
252
|
+
listInactiveSelectionIconForeground: quickInputListFocusIconForeground,
|
|
253
|
+
listInactiveFocusBackground: quickInputListFocusBackground,
|
|
254
|
+
listFocusOutline: activeContrastBorder,
|
|
255
|
+
listInactiveFocusOutline: activeContrastBorder,
|
|
256
|
+
}),
|
|
257
|
+
pickerGroup: {
|
|
258
|
+
pickerGroupBorder: asCssVariable(pickerGroupBorder),
|
|
259
|
+
pickerGroupForeground: asCssVariable(pickerGroupForeground),
|
|
260
|
+
}
|
|
272
261
|
};
|
|
273
262
|
}
|
|
274
263
|
}
|
|
@@ -282,7 +271,8 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
282
271
|
protected readonly keybindingRegistry: KeybindingRegistry;
|
|
283
272
|
|
|
284
273
|
get backButton(): QuickInputButton {
|
|
285
|
-
|
|
274
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
275
|
+
return this.monacoService.backButton as QuickInputButton;
|
|
286
276
|
}
|
|
287
277
|
|
|
288
278
|
get onShow(): Event<void> { return this.monacoService.onShow; }
|
|
@@ -293,7 +283,8 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
293
283
|
}
|
|
294
284
|
|
|
295
285
|
createInputBox(): InputBox {
|
|
296
|
-
|
|
286
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
287
|
+
return this.monacoService.createInputBox() as InputBox;
|
|
297
288
|
}
|
|
298
289
|
|
|
299
290
|
input(options?: InputOptions, token?: monaco.CancellationToken): Promise<string | undefined> {
|
|
@@ -309,39 +300,9 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
309
300
|
}
|
|
310
301
|
|
|
311
302
|
async pick<T extends QuickPickItem, O extends PickOptions<T> = PickOptions<T>>(
|
|
312
|
-
picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: O, token?:
|
|
313
|
-
): Promise<
|
|
314
|
-
|
|
315
|
-
type R = (O extends { canPickMany: true; } ? T[] : T);
|
|
316
|
-
|
|
317
|
-
const monacoPicks: Promise<QuickPickInput<IQuickPickItem>[]> = new Promise(async resolve => {
|
|
318
|
-
const updatedPicks = (await picks).map(pick => {
|
|
319
|
-
if (pick.type !== 'separator') {
|
|
320
|
-
const icon = pick.iconPath;
|
|
321
|
-
// @monaco-uplift
|
|
322
|
-
// Other kind of icons (URI and URI dark/light) shall be supported once monaco editor has been upgraded to at least 1.81.
|
|
323
|
-
// see https://github.com/eclipse-theia/theia/pull/12945#issue-1913645228
|
|
324
|
-
if (ThemeIcon.isThemeIcon(icon)) {
|
|
325
|
-
const codicon = codiconArray(icon.id);
|
|
326
|
-
if (pick.iconClasses) {
|
|
327
|
-
pick.iconClasses.push(...codicon);
|
|
328
|
-
} else {
|
|
329
|
-
pick.iconClasses = codicon;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
pick.buttons &&= pick.buttons.map(QuickInputButton.normalize);
|
|
333
|
-
}
|
|
334
|
-
return pick as M;
|
|
335
|
-
});
|
|
336
|
-
resolve(updatedPicks);
|
|
337
|
-
});
|
|
338
|
-
const monacoOptions = options as IPickOptions<M>;
|
|
339
|
-
const picked = await this.monacoService.pick(monacoPicks, monacoOptions, token);
|
|
340
|
-
if (!picked) { return picked; }
|
|
341
|
-
if (options?.canPickMany) {
|
|
342
|
-
return (Array.isArray(picked) ? picked : [picked]) as R;
|
|
343
|
-
}
|
|
344
|
-
return Array.isArray(picked) ? picked[0] : picked;
|
|
303
|
+
picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: O, token?: CancellationToken
|
|
304
|
+
): Promise<T[] | T | undefined> {
|
|
305
|
+
return this.monacoService.pick(picks, options, token);
|
|
345
306
|
}
|
|
346
307
|
|
|
347
308
|
showQuickPick<T extends QuickPickItem>(items: Array<T | QuickPickSeparator>, options?: QuickPickOptions<T>): Promise<T | undefined> {
|
|
@@ -394,7 +355,8 @@ export class MonacoQuickInputService implements QuickInputService {
|
|
|
394
355
|
});
|
|
395
356
|
wrapped.onDidTriggerButton((button: IQuickInputButton) => {
|
|
396
357
|
if (options.onDidTriggerButton) {
|
|
397
|
-
|
|
358
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
359
|
+
options.onDidTriggerButton(button as QuickInputButton);
|
|
398
360
|
}
|
|
399
361
|
});
|
|
400
362
|
wrapped.onDidTriggerItemButton((event: QuickPickItemButtonEvent<T>) => {
|
|
@@ -577,7 +539,14 @@ class MonacoQuickPick<T extends QuickPickItem> extends MonacoQuickInput implemen
|
|
|
577
539
|
}
|
|
578
540
|
|
|
579
541
|
get items(): readonly (T | QuickPickSeparator)[] {
|
|
580
|
-
|
|
542
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
543
|
+
return this.wrapped.items.map(item => {
|
|
544
|
+
if (item instanceof MonacoQuickPickItem) {
|
|
545
|
+
return item.item;
|
|
546
|
+
} else {
|
|
547
|
+
return item;
|
|
548
|
+
}
|
|
549
|
+
});
|
|
581
550
|
}
|
|
582
551
|
|
|
583
552
|
set items(itemList: readonly (T | QuickPickSeparator)[]) {
|
|
@@ -610,12 +579,14 @@ class MonacoQuickPick<T extends QuickPickItem> extends MonacoQuickInput implemen
|
|
|
610
579
|
|
|
611
580
|
readonly onDidAccept: Event<{ inBackground: boolean }> = this.wrapped.onDidAccept;
|
|
612
581
|
readonly onDidChangeValue: Event<string> = this.wrapped.onDidChangeValue;
|
|
613
|
-
|
|
582
|
+
|
|
583
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
584
|
+
readonly onDidTriggerButton: Event<QuickInputButton> = this.wrapped.onDidTriggerButton as Event<QuickInputButton>;
|
|
614
585
|
readonly onDidTriggerItemButton: Event<QuickPickItemButtonEvent<T>> =
|
|
615
586
|
Event.map(this.wrapped.onDidTriggerItemButton, (evt: IQuickPickItemButtonEvent<MonacoQuickPickItem<T>>) => ({
|
|
616
587
|
item: evt.item.item,
|
|
617
588
|
button: evt.button
|
|
618
|
-
}))
|
|
589
|
+
})) as Event<QuickPickItemButtonEvent<T>>;
|
|
619
590
|
readonly onDidChangeActive: Event<T[]> = Event.map(
|
|
620
591
|
this.wrapped.onDidChangeActive,
|
|
621
592
|
(items: MonacoQuickPickItem<T>[]) => items.map(item => item.item));
|
|
@@ -630,7 +601,7 @@ class MonacoQuickPick<T extends QuickPickItem> extends MonacoQuickInput implemen
|
|
|
630
601
|
const monacoReferences: MonacoQuickPickItem<T>[] = [];
|
|
631
602
|
for (const item of items) {
|
|
632
603
|
for (const wrappedItem of source) {
|
|
633
|
-
if (
|
|
604
|
+
if (wrappedItem instanceof MonacoQuickPickItem && wrappedItem.item === item) {
|
|
634
605
|
monacoReferences.push(wrappedItem);
|
|
635
606
|
}
|
|
636
607
|
}
|
|
@@ -663,7 +634,7 @@ export class MonacoQuickPickItem<T extends QuickPickItem> implements IQuickPickI
|
|
|
663
634
|
this.detail = item.detail;
|
|
664
635
|
this.keybinding = item.keySequence ? new MonacoResolvedKeybinding(item.keySequence, kbRegistry) : undefined;
|
|
665
636
|
this.iconClasses = item.iconClasses;
|
|
666
|
-
this.buttons = item.buttons
|
|
637
|
+
this.buttons = item.buttons;
|
|
667
638
|
this.alwaysShow = item.alwaysShow;
|
|
668
639
|
this.highlights = item.highlights;
|
|
669
640
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { KeyCode as MonacoKeyCode } from '@theia/monaco-editor-core/esm/vs/base/common/keyCodes';
|
|
18
18
|
import {
|
|
19
|
-
|
|
19
|
+
ResolvedKeybinding, ResolvedChord, SingleModifierChord, KeyCodeChord, Chord
|
|
20
20
|
} from '@theia/monaco-editor-core/esm/vs/base/common/keybindings';
|
|
21
21
|
import { ElectronAcceleratorLabelProvider, UILabelProvider, UserSettingsLabelProvider } from '@theia/monaco-editor-core/esm/vs/base/common/keybindingLabels';
|
|
22
22
|
import { USLayoutResolvedKeybinding } from '@theia/monaco-editor-core/esm/vs/platform/keybinding/common/usLayoutResolvedKeybinding';
|
|
@@ -28,15 +28,15 @@ import { KEY_CODE_MAP } from './monaco-keycode-map';
|
|
|
28
28
|
|
|
29
29
|
export class MonacoResolvedKeybinding extends ResolvedKeybinding {
|
|
30
30
|
|
|
31
|
-
protected readonly
|
|
31
|
+
protected readonly chords: ResolvedChord[];
|
|
32
32
|
|
|
33
33
|
constructor(protected readonly keySequence: KeySequence, keybindingService: KeybindingRegistry) {
|
|
34
34
|
super();
|
|
35
|
-
this.
|
|
35
|
+
this.chords = keySequence.map(keyCode => {
|
|
36
36
|
// eslint-disable-next-line no-null/no-null
|
|
37
37
|
const keyLabel = keyCode.key ? keybindingService.acceleratorForKey(keyCode.key) : null;
|
|
38
38
|
const keyAriaLabel = keyLabel;
|
|
39
|
-
return new
|
|
39
|
+
return new ResolvedChord(
|
|
40
40
|
keyCode.ctrl,
|
|
41
41
|
keyCode.shift,
|
|
42
42
|
keyCode.alt,
|
|
@@ -48,43 +48,43 @@ export class MonacoResolvedKeybinding extends ResolvedKeybinding {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
getLabel(): string | null {
|
|
51
|
-
return UILabelProvider.toLabel(MonacoPlatform.OS, this.
|
|
51
|
+
return UILabelProvider.toLabel(MonacoPlatform.OS, this.chords, p => p.keyLabel);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
getAriaLabel(): string | null {
|
|
55
|
-
return UILabelProvider.toLabel(MonacoPlatform.OS, this.
|
|
55
|
+
return UILabelProvider.toLabel(MonacoPlatform.OS, this.chords, p => p.keyAriaLabel);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
getElectronAccelerator(): string | null {
|
|
59
|
-
if (this.
|
|
59
|
+
if (this.hasMultipleChords()) {
|
|
60
60
|
// Electron cannot handle chords
|
|
61
61
|
// eslint-disable-next-line no-null/no-null
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
|
-
return ElectronAcceleratorLabelProvider.toLabel(MonacoPlatform.OS, this.
|
|
64
|
+
return ElectronAcceleratorLabelProvider.toLabel(MonacoPlatform.OS, this.chords, p => p.keyLabel);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
getUserSettingsLabel(): string | null {
|
|
68
|
-
return UserSettingsLabelProvider.toLabel(MonacoPlatform.OS, this.
|
|
68
|
+
return UserSettingsLabelProvider.toLabel(MonacoPlatform.OS, this.chords, p => p.keyLabel);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
isWYSIWYG(): boolean {
|
|
72
72
|
return true;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
return this.
|
|
75
|
+
hasMultipleChords(): boolean {
|
|
76
|
+
return this.chords.length > 1;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
getDispatchChords(): (string | null)[] {
|
|
80
80
|
return this.keySequence.map(keyCode => USLayoutResolvedKeybinding.getDispatchStr(this.toKeybinding(keyCode)));
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
getSingleModifierDispatchChords(): (SingleModifierChord | null)[] {
|
|
84
84
|
return this.keySequence.map(keybinding => this.getSingleModifierDispatchPart(keybinding));
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
protected getSingleModifierDispatchPart(code: KeyCode):
|
|
87
|
+
protected getSingleModifierDispatchPart(code: KeyCode): SingleModifierChord | null {
|
|
88
88
|
if (code.key?.keyCode === undefined) {
|
|
89
89
|
return null; // eslint-disable-line no-null/no-null
|
|
90
90
|
}
|
|
@@ -103,8 +103,8 @@ export class MonacoResolvedKeybinding extends ResolvedKeybinding {
|
|
|
103
103
|
return null; // eslint-disable-line no-null/no-null
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
private toKeybinding(keyCode: KeyCode):
|
|
107
|
-
return new
|
|
106
|
+
private toKeybinding(keyCode: KeyCode): KeyCodeChord {
|
|
107
|
+
return new KeyCodeChord(
|
|
108
108
|
keyCode.ctrl,
|
|
109
109
|
keyCode.shift,
|
|
110
110
|
keyCode.alt,
|
|
@@ -113,16 +113,16 @@ export class MonacoResolvedKeybinding extends ResolvedKeybinding {
|
|
|
113
113
|
);
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
public
|
|
117
|
-
return this.
|
|
116
|
+
public getChords(): ResolvedChord[] {
|
|
117
|
+
return this.chords;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
static toKeybinding(keybindings: Array<
|
|
120
|
+
static toKeybinding(keybindings: Array<Chord>): string {
|
|
121
121
|
return keybindings.map(binding => this.keyCode(binding)).join(' ');
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
static keyCode(keybinding:
|
|
125
|
-
const keyCode = keybinding instanceof
|
|
124
|
+
static keyCode(keybinding: Chord): KeyCode {
|
|
125
|
+
const keyCode = keybinding instanceof KeyCodeChord ? keybinding.keyCode : USLayoutResolvedKeybinding['_scanCodeToKeyCode'](keybinding.scanCode);
|
|
126
126
|
const sequence: Keystroke = {
|
|
127
127
|
first: Key.getKey(this.monaco2BrowserKeyCode(keyCode & 0xff)),
|
|
128
128
|
modifiers: []
|
|
@@ -146,8 +146,8 @@ export class MonacoResolvedKeybinding extends ResolvedKeybinding {
|
|
|
146
146
|
return KeyCode.createKeyCode(sequence);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
static keySequence(keybinding:
|
|
150
|
-
return keybinding.
|
|
149
|
+
static keySequence(keybinding: Chord[]): KeySequence {
|
|
150
|
+
return keybinding.map(part => this.keyCode(part));
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
private static monaco2BrowserKeyCode(keyCode: MonacoKeyCode): number {
|
|
@@ -194,6 +194,6 @@ export class MonacoTextModelService implements ITextModelService {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
canHandleResource(resource: monaco.Uri): boolean {
|
|
197
|
-
return this.fileService.canHandleResource(
|
|
197
|
+
return this.fileService.canHandleResource(URI.fromComponents(resource));
|
|
198
198
|
}
|
|
199
199
|
}
|