@theia/monaco 1.47.0-next.0 → 1.47.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/lib/browser/index.js +2 -11
  2. package/lib/browser/index.js.map +1 -1
  3. package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +0 -4
  4. package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts.map +1 -1
  5. package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +18 -41
  6. package/lib/browser/markdown-renderer/monaco-markdown-renderer.js.map +1 -1
  7. package/lib/browser/monaco-bulk-edit-service.d.ts +1 -3
  8. package/lib/browser/monaco-bulk-edit-service.d.ts.map +1 -1
  9. package/lib/browser/monaco-bulk-edit-service.js +5 -13
  10. package/lib/browser/monaco-bulk-edit-service.js.map +1 -1
  11. package/lib/browser/monaco-color-registry.js +2 -7
  12. package/lib/browser/monaco-color-registry.js.map +1 -1
  13. package/lib/browser/monaco-command-registry.d.ts +1 -1
  14. package/lib/browser/monaco-command-registry.d.ts.map +1 -1
  15. package/lib/browser/monaco-command-registry.js +11 -16
  16. package/lib/browser/monaco-command-registry.js.map +1 -1
  17. package/lib/browser/monaco-command-service.d.ts +1 -6
  18. package/lib/browser/monaco-command-service.d.ts.map +1 -1
  19. package/lib/browser/monaco-command-service.js +20 -30
  20. package/lib/browser/monaco-command-service.js.map +1 -1
  21. package/lib/browser/monaco-command.d.ts +0 -6
  22. package/lib/browser/monaco-command.d.ts.map +1 -1
  23. package/lib/browser/monaco-command.js +19 -40
  24. package/lib/browser/monaco-command.js.map +1 -1
  25. package/lib/browser/monaco-context-key-service.d.ts +2 -2
  26. package/lib/browser/monaco-context-key-service.d.ts.map +1 -1
  27. package/lib/browser/monaco-context-key-service.js +11 -20
  28. package/lib/browser/monaco-context-key-service.js.map +1 -1
  29. package/lib/browser/monaco-context-menu.d.ts +4 -3
  30. package/lib/browser/monaco-context-menu.d.ts.map +1 -1
  31. package/lib/browser/monaco-context-menu.js +21 -19
  32. package/lib/browser/monaco-context-menu.js.map +1 -1
  33. package/lib/browser/monaco-diff-editor.d.ts +3 -3
  34. package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
  35. package/lib/browser/monaco-diff-editor.js +2 -2
  36. package/lib/browser/monaco-diff-editor.js.map +1 -1
  37. package/lib/browser/monaco-diff-navigator-factory.d.ts +2 -3
  38. package/lib/browser/monaco-diff-navigator-factory.d.ts.map +1 -1
  39. package/lib/browser/monaco-diff-navigator-factory.js +7 -33
  40. package/lib/browser/monaco-diff-navigator-factory.js.map +1 -1
  41. package/lib/browser/monaco-editor-model.d.ts +4 -2
  42. package/lib/browser/monaco-editor-model.d.ts.map +1 -1
  43. package/lib/browser/monaco-editor-model.js +4 -1
  44. package/lib/browser/monaco-editor-model.js.map +1 -1
  45. package/lib/browser/monaco-editor-provider.d.ts +3 -20
  46. package/lib/browser/monaco-editor-provider.d.ts.map +1 -1
  47. package/lib/browser/monaco-editor-provider.js +37 -95
  48. package/lib/browser/monaco-editor-provider.js.map +1 -1
  49. package/lib/browser/monaco-editor-service.d.ts +7 -2
  50. package/lib/browser/monaco-editor-service.d.ts.map +1 -1
  51. package/lib/browser/monaco-editor-service.js +23 -31
  52. package/lib/browser/monaco-editor-service.js.map +1 -1
  53. package/lib/browser/monaco-editor.d.ts +4 -1
  54. package/lib/browser/monaco-editor.d.ts.map +1 -1
  55. package/lib/browser/monaco-editor.js +33 -26
  56. package/lib/browser/monaco-editor.js.map +1 -1
  57. package/lib/browser/monaco-formatting-conflicts.js +10 -18
  58. package/lib/browser/monaco-formatting-conflicts.js.map +1 -1
  59. package/lib/browser/monaco-frontend-application-contribution.d.ts +0 -6
  60. package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
  61. package/lib/browser/monaco-frontend-application-contribution.js +18 -63
  62. package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
  63. package/lib/browser/monaco-frontend-module.d.ts.map +1 -1
  64. package/lib/browser/monaco-frontend-module.js +17 -8
  65. package/lib/browser/monaco-frontend-module.js.map +1 -1
  66. package/lib/browser/monaco-gotoline-quick-access.js +5 -16
  67. package/lib/browser/monaco-gotoline-quick-access.js.map +1 -1
  68. package/lib/browser/monaco-gotosymbol-quick-access.js +7 -18
  69. package/lib/browser/monaco-gotosymbol-quick-access.js.map +1 -1
  70. package/lib/browser/monaco-icon-registry.d.ts +1 -2
  71. package/lib/browser/monaco-icon-registry.d.ts.map +1 -1
  72. package/lib/browser/monaco-icon-registry.js +4 -7
  73. package/lib/browser/monaco-icon-registry.js.map +1 -1
  74. package/lib/browser/monaco-indexed-db.js +2 -7
  75. package/lib/browser/monaco-indexed-db.js.map +1 -1
  76. package/lib/browser/monaco-init.d.ts +5 -0
  77. package/lib/browser/monaco-init.d.ts.map +1 -0
  78. package/lib/browser/monaco-init.js +114 -0
  79. package/lib/browser/monaco-init.js.map +1 -0
  80. package/lib/browser/monaco-keybinding.js +17 -25
  81. package/lib/browser/monaco-keybinding.js.map +1 -1
  82. package/lib/browser/monaco-keycode-map.js +37 -37
  83. package/lib/browser/monaco-keycode-map.js.map +1 -1
  84. package/lib/browser/monaco-languages.js +10 -18
  85. package/lib/browser/monaco-languages.js.map +1 -1
  86. package/lib/browser/monaco-menu.js +4 -15
  87. package/lib/browser/monaco-menu.js.map +1 -1
  88. package/lib/browser/monaco-mime-service.js +3 -11
  89. package/lib/browser/monaco-mime-service.js.map +1 -1
  90. package/lib/browser/monaco-outline-contribution.js +6 -14
  91. package/lib/browser/monaco-outline-contribution.js.map +1 -1
  92. package/lib/browser/monaco-outline-decorator.js +2 -7
  93. package/lib/browser/monaco-outline-decorator.js.map +1 -1
  94. package/lib/browser/monaco-quick-access-registry.js +4 -12
  95. package/lib/browser/monaco-quick-access-registry.js.map +1 -1
  96. package/lib/browser/monaco-quick-input-service.d.ts +7 -9
  97. package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
  98. package/lib/browser/monaco-quick-input-service.js +116 -111
  99. package/lib/browser/monaco-quick-input-service.js.map +1 -1
  100. package/lib/browser/monaco-resolved-keybinding.d.ts +10 -10
  101. package/lib/browser/monaco-resolved-keybinding.d.ts.map +1 -1
  102. package/lib/browser/monaco-resolved-keybinding.js +16 -16
  103. package/lib/browser/monaco-resolved-keybinding.js.map +1 -1
  104. package/lib/browser/monaco-snippet-suggest-provider.js +4 -12
  105. package/lib/browser/monaco-snippet-suggest-provider.js.map +1 -1
  106. package/lib/browser/monaco-status-bar-contribution.js +5 -16
  107. package/lib/browser/monaco-status-bar-contribution.js.map +1 -1
  108. package/lib/browser/monaco-text-model-service.js +21 -29
  109. package/lib/browser/monaco-text-model-service.js.map +1 -1
  110. package/lib/browser/monaco-theming-service.js +8 -16
  111. package/lib/browser/monaco-theming-service.js.map +1 -1
  112. package/lib/browser/monaco-to-protocol-converter.js +2 -7
  113. package/lib/browser/monaco-to-protocol-converter.js.map +1 -1
  114. package/lib/browser/monaco-workspace.d.ts +1 -3
  115. package/lib/browser/monaco-workspace.d.ts.map +1 -1
  116. package/lib/browser/monaco-workspace.js +27 -35
  117. package/lib/browser/monaco-workspace.js.map +1 -1
  118. package/lib/browser/protocol-to-monaco-converter.js +2 -7
  119. package/lib/browser/protocol-to-monaco-converter.js.map +1 -1
  120. package/lib/browser/simple-monaco-editor.d.ts +1 -0
  121. package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
  122. package/lib/browser/simple-monaco-editor.js +10 -2
  123. package/lib/browser/simple-monaco-editor.js.map +1 -1
  124. package/lib/browser/textmate/index.js +5 -14
  125. package/lib/browser/textmate/index.js.map +1 -1
  126. package/lib/browser/textmate/monaco-textmate-service.js +19 -27
  127. package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
  128. package/lib/browser/textmate/monaco-theme-registry.js +4 -12
  129. package/lib/browser/textmate/monaco-theme-registry.js.map +1 -1
  130. package/lib/browser/textmate/textmate-registry.js +2 -7
  131. package/lib/browser/textmate/textmate-registry.js.map +1 -1
  132. package/lib/browser/workspace-symbol-command.js +14 -22
  133. package/lib/browser/workspace-symbol-command.js.map +1 -1
  134. package/package.json +11 -10
  135. package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +10 -18
  136. package/src/browser/monaco-bulk-edit-service.ts +2 -2
  137. package/src/browser/monaco-command-registry.ts +4 -1
  138. package/src/browser/monaco-command-service.ts +16 -25
  139. package/src/browser/monaco-command.ts +5 -15
  140. package/src/browser/monaco-context-key-service.ts +7 -6
  141. package/src/browser/monaco-context-menu.ts +13 -3
  142. package/src/browser/monaco-diff-editor.ts +8 -9
  143. package/src/browser/monaco-diff-navigator-factory.ts +6 -28
  144. package/src/browser/monaco-editor-model.ts +6 -3
  145. package/src/browser/monaco-editor-provider.ts +25 -59
  146. package/src/browser/monaco-editor-service.ts +10 -5
  147. package/src/browser/monaco-editor.ts +28 -9
  148. package/src/browser/monaco-frontend-application-contribution.ts +0 -35
  149. package/src/browser/monaco-frontend-module.ts +25 -17
  150. package/src/browser/monaco-icon-registry.ts +6 -4
  151. package/src/browser/monaco-init.ts +114 -0
  152. package/src/browser/monaco-keybinding.ts +3 -3
  153. package/src/browser/monaco-quick-input-service.ts +114 -96
  154. package/src/browser/monaco-resolved-keybinding.ts +23 -23
  155. package/src/browser/monaco-text-model-service.ts +1 -1
  156. package/src/browser/monaco-workspace.ts +10 -10
  157. package/src/browser/simple-monaco-editor.ts +9 -2
  158. 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, NormalizedQuickInputButton, PickOptions,
19
+ InputBox, InputOptions, KeybindingRegistry, PickOptions,
20
20
  QuickInputButton, QuickInputHideReason, QuickInputService, QuickPick, QuickPickItem,
21
- QuickPickItemButtonEvent, QuickPickItemHighlights, QuickPickOptions, QuickPickSeparator, codiconArray
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, QuickInputController } from '@theia/monaco-editor-core/esm/vs/base/parts/quickinput/browser/quickInput';
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 { ContextKeyService as VSCodeContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService';
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,10 @@ 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 { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService';
46
45
 
47
46
  // Copied from @vscode/src/vs/base/parts/quickInput/browser/quickInputList.ts
48
47
  export interface IListElement {
@@ -62,6 +61,7 @@ export interface IListElement {
62
61
 
63
62
  @injectable()
64
63
  export class MonacoQuickInputImplementation implements IQuickInputService {
64
+
65
65
  declare readonly _serviceBrand: undefined;
66
66
 
67
67
  controller: QuickInputController;
@@ -76,9 +76,6 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
76
76
  @inject(ThemeService)
77
77
  protected readonly themeService: ThemeService;
78
78
 
79
- @inject(VSCodeContextKeyService)
80
- protected readonly contextKeyService: VSCodeContextKeyService;
81
-
82
79
  protected container: HTMLElement;
83
80
  private quickInputList: List<unknown>;
84
81
 
@@ -93,25 +90,29 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
93
90
  this.initContainer();
94
91
  this.initController();
95
92
  this.quickAccess = new QuickAccessController(this, StandaloneServices.get(IInstantiationService));
96
- this.inQuickOpen = this.contextKeyService.createKey<boolean>('inQuickOpen', false);
93
+ this.inQuickOpen = StandaloneServices.get(IContextKeyService).createKey<boolean>('inQuickOpen', false);
97
94
  this.controller.onShow(() => {
98
95
  this.container.style.top = this.shell.mainPanel.node.getBoundingClientRect().top + 'px';
99
96
  this.inQuickOpen.set(true);
100
97
  });
101
98
  this.controller.onHide(() => this.inQuickOpen.set(false));
102
99
 
103
- this.themeService.initialized.then(() => this.controller.applyStyles(this.getStyles()));
100
+ this.themeService.initialized.then(() => this.controller.applyStyles(this.computeStyles()));
104
101
  // Hook into the theming service of Monaco to ensure that the updates are ready.
105
- StandaloneServices.get(IStandaloneThemeService).onDidColorThemeChange(() => this.controller.applyStyles(this.getStyles()));
102
+ StandaloneServices.get(IStandaloneThemeService).onDidColorThemeChange(() => this.controller.applyStyles(this.computeStyles()));
106
103
  window.addEventListener('resize', () => this.updateLayout());
107
104
  }
108
105
 
109
106
  setContextKey(key: string | undefined): void {
110
107
  if (key) {
111
- this.contextKeyService.createKey<string>(key, undefined);
108
+ StandaloneServices.get(IContextKeyService).createKey<string>(key, undefined);
112
109
  }
113
110
  }
114
111
 
112
+ createQuickWidget(): IQuickWidget {
113
+ return this.controller.createQuickWidget();
114
+ }
115
+
115
116
  createQuickPick<T extends IQuickPickItem>(): IQuickPick<T> {
116
117
  return this.controller.createQuickPick<T>();
117
118
  }
@@ -184,7 +185,7 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
184
185
  }
185
186
 
186
187
  private initController(): void {
187
- this.controller = new QuickInputController(this.getOptions());
188
+ this.controller = new QuickInputController(this.getOptions(), StandaloneServices.get(IStandaloneThemeService));
188
189
  this.updateLayout();
189
190
  }
190
191
 
@@ -202,72 +203,107 @@ export class MonacoQuickInputImplementation implements IQuickInputService {
202
203
  const options: IQuickInputOptions = {
203
204
  idPrefix: 'quickInput_',
204
205
  container: this.container,
205
- styles: { widget: {}, list: {}, inputBox: {}, countBadge: {}, button: {}, progressBar: {}, keybindingLabel: {}, },
206
+ styles: this.computeStyles(),
206
207
  ignoreFocusOut: () => false,
207
- isScreenReaderOptimized: () => false, // TODO change to true once support is added.
208
208
  backKeybindingLabel: () => undefined,
209
209
  setContextKey: (id?: string) => this.setContextKey(id),
210
210
  returnFocus: () => this.container.focus(),
211
211
  createList: <T>(
212
212
  user: string, container: HTMLElement, delegate: IListVirtualDelegate<T>, renderers: IListRenderer<T, unknown>[], listOptions: IListOptions<T>
213
213
  ): List<T> => this.quickInputList = new List(user, container, delegate, renderers, listOptions),
214
+ linkOpenerDelegate: () => {
215
+ // @monaco-uplift: not sure what to do here
216
+ }
214
217
  };
215
218
  return options;
216
219
  }
217
220
 
218
221
  // @monaco-uplift
219
222
  // Keep the styles up to date with https://github.com/microsoft/vscode/blob/7888ff3a6b104e9e2e3d0f7890ca92dd0828215f/src/vs/platform/quickinput/browser/quickInput.ts#L171.
220
- private getStyles(): IQuickInputStyles {
223
+ private computeStyles(): IQuickInputStyles {
221
224
  return {
225
+ toggle: {
226
+ inputActiveOptionBorder: this.colorRegistry.toCssVariableName('inputOption.activeBorder'),
227
+ inputActiveOptionForeground: this.colorRegistry.toCssVariableName('inputOption.activeForeground'),
228
+ inputActiveOptionBackground: this.colorRegistry.toCssVariableName('inputOption.activeBackground')
229
+ },
230
+ pickerGroup: {
231
+ pickerGroupBorder: this.colorRegistry.toCssVariableName('pickerGroup.Border'),
232
+ pickerGroupForeground: this.colorRegistry.toCssVariableName('pickerGroupForeground')
233
+ },
222
234
  widget: {
223
- quickInputBackground: this.colorRegistry.getColor('quickInput.background'),
224
- quickInputForeground: this.colorRegistry.getColor('quickInput.foreground'),
225
- quickInputTitleBackground: this.colorRegistry.getColor('quickInputTitle.background')
235
+ quickInputBackground: this.colorRegistry.toCssVariableName('quickInput.background'),
236
+ quickInputForeground: this.colorRegistry.toCssVariableName('quickInput.foreground'),
237
+ quickInputTitleBackground: this.colorRegistry.toCssVariableName('quickInputTitle.background'),
238
+ widgetBorder: this.colorRegistry.toCssVariableName('widget.border'),
239
+ widgetShadow: this.colorRegistry.toCssVariableName('widget.shadow')
226
240
  },
227
241
  list: {
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')
242
+ listBackground: this.colorRegistry.toCssVariableName('quickInput.background'),
243
+ listInactiveFocusForeground: this.colorRegistry.toCssVariableName('quickInputList.focusForeground'),
244
+ listInactiveSelectionIconForeground: this.colorRegistry.toCssVariableName('quickInputList.focusIconForeground'),
245
+ listInactiveFocusBackground: this.colorRegistry.toCssVariableName('quickInputList.focusBackground'),
246
+ listFocusOutline: this.colorRegistry.toCssVariableName('activeContrastBorder'),
247
+ listInactiveFocusOutline: this.colorRegistry.toCssVariableName('activeContrastBorder'),
248
+
249
+ listFocusBackground: this.colorRegistry.toCssVariableName('list.focusBackground'),
250
+ listFocusForeground: this.colorRegistry.toCssVariableName('list.focusForeground'),
251
+ listActiveSelectionBackground: this.colorRegistry.toCssVariableName('list.activeSelectionBackground'),
252
+ listActiveSelectionForeground: this.colorRegistry.toCssVariableName('list.ActiveSelectionForeground'),
253
+ listActiveSelectionIconForeground: this.colorRegistry.toCssVariableName('list.ActiveSelectionIconForeground'),
254
+ listFocusAndSelectionOutline: this.colorRegistry.toCssVariableName('list.FocusAndSelectionOutline'),
255
+ listFocusAndSelectionBackground: this.colorRegistry.toCssVariableName('list.ActiveSelectionBackground'),
256
+ listFocusAndSelectionForeground: this.colorRegistry.toCssVariableName('list.ActiveSelectionForeground'),
257
+ listInactiveSelectionBackground: this.colorRegistry.toCssVariableName('list.InactiveSelectionBackground'),
258
+ listInactiveSelectionForeground: this.colorRegistry.toCssVariableName('list.InactiveSelectionForeground'),
259
+ listHoverBackground: this.colorRegistry.toCssVariableName('list.HoverBackground'),
260
+ listHoverForeground: this.colorRegistry.toCssVariableName('list.HoverForeground'),
261
+ listDropBackground: this.colorRegistry.toCssVariableName('list.DropBackground'),
262
+ listSelectionOutline: this.colorRegistry.toCssVariableName('activeContrastBorder'),
263
+ listHoverOutline: this.colorRegistry.toCssVariableName('activeContrastBorder'),
264
+ treeIndentGuidesStroke: this.colorRegistry.toCssVariableName('tree.indentGuidesStroke'),
265
+ treeInactiveIndentGuidesStroke: this.colorRegistry.toCssVariableName('tree.inactiveIndentGuidesStroke'),
266
+ tableColumnsBorder: this.colorRegistry.toCssVariableName('tree.tableColumnsBorder'),
267
+ tableOddRowsBackgroundColor: this.colorRegistry.toCssVariableName('tree.tableOddRowsBackground'),
236
268
  },
237
269
  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'),
270
+ inputForeground: this.colorRegistry.toCssVariableName('inputForeground'),
271
+ inputBackground: this.colorRegistry.toCssVariableName('inputBackground'),
272
+ inputBorder: this.colorRegistry.toCssVariableName('inputBorder'),
273
+ inputValidationInfoBackground: this.colorRegistry.toCssVariableName('inputValidation.infoBackground'),
274
+ inputValidationInfoForeground: this.colorRegistry.toCssVariableName('inputValidation.infoForeground'),
275
+ inputValidationInfoBorder: this.colorRegistry.toCssVariableName('inputValidation.infoBorder'),
276
+ inputValidationWarningBackground: this.colorRegistry.toCssVariableName('inputValidation.warningBackground'),
277
+ inputValidationWarningForeground: this.colorRegistry.toCssVariableName('inputValidation.warningForeground'),
278
+ inputValidationWarningBorder: this.colorRegistry.toCssVariableName('inputValidation.warningBorder'),
279
+ inputValidationErrorBackground: this.colorRegistry.toCssVariableName('inputValidation.errorBackground'),
280
+ inputValidationErrorForeground: this.colorRegistry.toCssVariableName('inputValidation.errorForeground'),
281
+ inputValidationErrorBorder: this.colorRegistry.toCssVariableName('inputValidation.errorBorder'),
250
282
  },
251
283
  countBadge: {
252
- badgeBackground: this.colorRegistry.getColor('badge.background'),
253
- badgeForeground: this.colorRegistry.getColor('badge.foreground'),
254
- badgeBorder: this.colorRegistry.getColor('contrastBorder')
284
+ badgeBackground: this.colorRegistry.toCssVariableName('badge.background'),
285
+ badgeForeground: this.colorRegistry.toCssVariableName('badge.foreground'),
286
+ badgeBorder: this.colorRegistry.toCssVariableName('contrastBorder')
255
287
  },
256
288
  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')
289
+ buttonForeground: this.colorRegistry.toCssVariableName('button.foreground'),
290
+ buttonBackground: this.colorRegistry.toCssVariableName('button.background'),
291
+ buttonHoverBackground: this.colorRegistry.toCssVariableName('button.hoverBackground'),
292
+ buttonBorder: this.colorRegistry.toCssVariableName('contrastBorder'),
293
+ buttonSeparator: this.colorRegistry.toCssVariableName('button.Separator'),
294
+ buttonSecondaryForeground: this.colorRegistry.toCssVariableName('button.secondaryForeground'),
295
+ buttonSecondaryBackground: this.colorRegistry.toCssVariableName('button.secondaryBackground'),
296
+ buttonSecondaryHoverBackground: this.colorRegistry.toCssVariableName('button.secondaryHoverBackground'),
261
297
  },
262
298
  progressBar: {
263
- progressBarBackground: this.colorRegistry.getColor('progressBar.background')
299
+ progressBarBackground: this.colorRegistry.toCssVariableName('progressBar.background')
264
300
  },
265
301
  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')
302
+ keybindingLabelBackground: this.colorRegistry.toCssVariableName('keybindingLabel.background'),
303
+ keybindingLabelForeground: this.colorRegistry.toCssVariableName('keybindingLabel.foreground'),
304
+ keybindingLabelBorder: this.colorRegistry.toCssVariableName('keybindingLabel.border'),
305
+ keybindingLabelBottomBorder: this.colorRegistry.toCssVariableName('keybindingLabel.bottomBorder'),
306
+ keybindingLabelShadow: this.colorRegistry.toCssVariableName('widget.shadow')
271
307
  },
272
308
  };
273
309
  }
@@ -282,7 +318,8 @@ export class MonacoQuickInputService implements QuickInputService {
282
318
  protected readonly keybindingRegistry: KeybindingRegistry;
283
319
 
284
320
  get backButton(): QuickInputButton {
285
- return this.monacoService.backButton;
321
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
322
+ return this.monacoService.backButton as QuickInputButton;
286
323
  }
287
324
 
288
325
  get onShow(): Event<void> { return this.monacoService.onShow; }
@@ -293,7 +330,8 @@ export class MonacoQuickInputService implements QuickInputService {
293
330
  }
294
331
 
295
332
  createInputBox(): InputBox {
296
- return this.monacoService.createInputBox();
333
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
334
+ return this.monacoService.createInputBox() as InputBox;
297
335
  }
298
336
 
299
337
  input(options?: InputOptions, token?: monaco.CancellationToken): Promise<string | undefined> {
@@ -309,39 +347,9 @@ export class MonacoQuickInputService implements QuickInputService {
309
347
  }
310
348
 
311
349
  async pick<T extends QuickPickItem, O extends PickOptions<T> = PickOptions<T>>(
312
- picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: O, token?: monaco.CancellationToken
313
- ): Promise<(O extends { canPickMany: true; } ? T[] : T) | undefined> {
314
- type M = T & { buttons?: NormalizedQuickInputButton[] };
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;
350
+ picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: O, token?: CancellationToken
351
+ ): Promise<T[] | T | undefined> {
352
+ return this.monacoService.pick(picks, options, token);
345
353
  }
346
354
 
347
355
  showQuickPick<T extends QuickPickItem>(items: Array<T | QuickPickSeparator>, options?: QuickPickOptions<T>): Promise<T | undefined> {
@@ -394,7 +402,8 @@ export class MonacoQuickInputService implements QuickInputService {
394
402
  });
395
403
  wrapped.onDidTriggerButton((button: IQuickInputButton) => {
396
404
  if (options.onDidTriggerButton) {
397
- options.onDidTriggerButton(button);
405
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
406
+ options.onDidTriggerButton(button as QuickInputButton);
398
407
  }
399
408
  });
400
409
  wrapped.onDidTriggerItemButton((event: QuickPickItemButtonEvent<T>) => {
@@ -577,7 +586,14 @@ class MonacoQuickPick<T extends QuickPickItem> extends MonacoQuickInput implemen
577
586
  }
578
587
 
579
588
  get items(): readonly (T | QuickPickSeparator)[] {
580
- return this.wrapped.items.map(item => QuickPickSeparator.is(item) ? item : item.item);
589
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
590
+ return this.wrapped.items.map(item => {
591
+ if (item instanceof MonacoQuickPickItem) {
592
+ return item.item;
593
+ } else {
594
+ return item;
595
+ }
596
+ });
581
597
  }
582
598
 
583
599
  set items(itemList: readonly (T | QuickPickSeparator)[]) {
@@ -610,12 +626,14 @@ class MonacoQuickPick<T extends QuickPickItem> extends MonacoQuickInput implemen
610
626
 
611
627
  readonly onDidAccept: Event<{ inBackground: boolean }> = this.wrapped.onDidAccept;
612
628
  readonly onDidChangeValue: Event<string> = this.wrapped.onDidChangeValue;
613
- readonly onDidTriggerButton: Event<QuickInputButton> = this.wrapped.onDidTriggerButton;
629
+
630
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
631
+ readonly onDidTriggerButton: Event<QuickInputButton> = this.wrapped.onDidTriggerButton as Event<QuickInputButton>;
614
632
  readonly onDidTriggerItemButton: Event<QuickPickItemButtonEvent<T>> =
615
633
  Event.map(this.wrapped.onDidTriggerItemButton, (evt: IQuickPickItemButtonEvent<MonacoQuickPickItem<T>>) => ({
616
634
  item: evt.item.item,
617
635
  button: evt.button
618
- }));
636
+ })) as Event<QuickPickItemButtonEvent<T>>;
619
637
  readonly onDidChangeActive: Event<T[]> = Event.map(
620
638
  this.wrapped.onDidChangeActive,
621
639
  (items: MonacoQuickPickItem<T>[]) => items.map(item => item.item));
@@ -630,7 +648,7 @@ class MonacoQuickPick<T extends QuickPickItem> extends MonacoQuickInput implemen
630
648
  const monacoReferences: MonacoQuickPickItem<T>[] = [];
631
649
  for (const item of items) {
632
650
  for (const wrappedItem of source) {
633
- if (!QuickPickSeparator.is(wrappedItem) && wrappedItem.item === item) {
651
+ if (wrappedItem instanceof MonacoQuickPickItem && wrappedItem.item === item) {
634
652
  monacoReferences.push(wrappedItem);
635
653
  }
636
654
  }
@@ -663,7 +681,7 @@ export class MonacoQuickPickItem<T extends QuickPickItem> implements IQuickPickI
663
681
  this.detail = item.detail;
664
682
  this.keybinding = item.keySequence ? new MonacoResolvedKeybinding(item.keySequence, kbRegistry) : undefined;
665
683
  this.iconClasses = item.iconClasses;
666
- this.buttons = item.buttons?.map(QuickInputButton.normalize);
684
+ this.buttons = item.buttons;
667
685
  this.alwaysShow = item.alwaysShow;
668
686
  this.highlights = item.highlights;
669
687
  }
@@ -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
- ChordKeybinding, KeybindingModifier, ResolvedKeybinding, ResolvedKeybindingPart, ScanCodeBinding, SimpleKeybinding
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 parts: ResolvedKeybindingPart[];
31
+ protected readonly chords: ResolvedChord[];
32
32
 
33
33
  constructor(protected readonly keySequence: KeySequence, keybindingService: KeybindingRegistry) {
34
34
  super();
35
- this.parts = keySequence.map(keyCode => {
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 ResolvedKeybindingPart(
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.parts, p => p.keyLabel);
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.parts, p => p.keyAriaLabel);
55
+ return UILabelProvider.toLabel(MonacoPlatform.OS, this.chords, p => p.keyAriaLabel);
56
56
  }
57
57
 
58
58
  getElectronAccelerator(): string | null {
59
- if (this.isChord()) {
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.parts, p => p.keyLabel);
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.parts, p => p.keyLabel);
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
- isChord(): boolean {
76
- return this.parts.length > 1;
75
+ hasMultipleChords(): boolean {
76
+ return this.chords.length > 1;
77
77
  }
78
78
 
79
- getDispatchParts(): (string | null)[] {
79
+ getDispatchChords(): (string | null)[] {
80
80
  return this.keySequence.map(keyCode => USLayoutResolvedKeybinding.getDispatchStr(this.toKeybinding(keyCode)));
81
81
  }
82
82
 
83
- getSingleModifierDispatchParts(): (KeybindingModifier | null)[] {
83
+ getSingleModifierDispatchChords(): (SingleModifierChord | null)[] {
84
84
  return this.keySequence.map(keybinding => this.getSingleModifierDispatchPart(keybinding));
85
85
  }
86
86
 
87
- protected getSingleModifierDispatchPart(code: KeyCode): KeybindingModifier | null {
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): SimpleKeybinding {
107
- return new SimpleKeybinding(
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 getParts(): ResolvedKeybindingPart[] {
117
- return this.parts;
116
+ public getChords(): ResolvedChord[] {
117
+ return this.chords;
118
118
  }
119
119
 
120
- static toKeybinding(keybindings: Array<SimpleKeybinding | ScanCodeBinding>): string {
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: SimpleKeybinding | ScanCodeBinding): KeyCode {
125
- const keyCode = keybinding instanceof SimpleKeybinding ? keybinding.keyCode : USLayoutResolvedKeybinding['_scanCodeToKeyCode'](keybinding.scanCode);
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: ChordKeybinding): KeySequence {
150
- return keybinding.parts.map(part => this.keyCode(part));
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(new URI(resource));
197
+ return this.fileService.canHandleResource(URI.fromComponents(resource));
198
198
  }
199
199
  }