@theia/monaco 1.45.1 → 1.46.0-next.72

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 (222) hide show
  1. package/README.md +100 -100
  2. package/data/monaco-nls.json +1379 -1379
  3. package/data/monaco-themes/vscode/dark_plus.json +201 -201
  4. package/data/monaco-themes/vscode/dark_theia.json +5 -5
  5. package/data/monaco-themes/vscode/dark_vs.json +393 -393
  6. package/data/monaco-themes/vscode/hc_black.json +457 -457
  7. package/data/monaco-themes/vscode/hc_light.json +590 -590
  8. package/data/monaco-themes/vscode/hc_theia.json +5 -5
  9. package/data/monaco-themes/vscode/hc_theia_light.json +5 -5
  10. package/data/monaco-themes/vscode/light_plus.json +202 -202
  11. package/data/monaco-themes/vscode/light_theia.json +10 -10
  12. package/data/monaco-themes/vscode/light_vs.json +421 -421
  13. package/lib/browser/index.d.ts +1 -1
  14. package/lib/browser/index.js +28 -28
  15. package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +20 -24
  16. package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts.map +1 -1
  17. package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +122 -137
  18. package/lib/browser/markdown-renderer/monaco-markdown-renderer.js.map +1 -1
  19. package/lib/browser/monaco-bulk-edit-service.d.ts +12 -14
  20. package/lib/browser/monaco-bulk-edit-service.d.ts.map +1 -1
  21. package/lib/browser/monaco-bulk-edit-service.js +66 -66
  22. package/lib/browser/monaco-bulk-edit-service.js.map +1 -1
  23. package/lib/browser/monaco-color-registry.d.ts +16 -16
  24. package/lib/browser/monaco-color-registry.js +82 -82
  25. package/lib/browser/monaco-command-registry.d.ts +19 -19
  26. package/lib/browser/monaco-command-registry.d.ts.map +1 -1
  27. package/lib/browser/monaco-command-registry.js +88 -85
  28. package/lib/browser/monaco-command-registry.js.map +1 -1
  29. package/lib/browser/monaco-command-service.d.ts +21 -26
  30. package/lib/browser/monaco-command-service.d.ts.map +1 -1
  31. package/lib/browser/monaco-command-service.js +93 -92
  32. package/lib/browser/monaco-command-service.js.map +1 -1
  33. package/lib/browser/monaco-command.d.ts +88 -94
  34. package/lib/browser/monaco-command.d.ts.map +1 -1
  35. package/lib/browser/monaco-command.js +294 -307
  36. package/lib/browser/monaco-command.js.map +1 -1
  37. package/lib/browser/monaco-context-key-service.d.ts +22 -22
  38. package/lib/browser/monaco-context-key-service.d.ts.map +1 -1
  39. package/lib/browser/monaco-context-key-service.js +146 -147
  40. package/lib/browser/monaco-context-key-service.js.map +1 -1
  41. package/lib/browser/monaco-context-menu.d.ts +17 -16
  42. package/lib/browser/monaco-context-menu.d.ts.map +1 -1
  43. package/lib/browser/monaco-context-menu.js +112 -102
  44. package/lib/browser/monaco-context-menu.js.map +1 -1
  45. package/lib/browser/monaco-diff-editor.d.ts +29 -29
  46. package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
  47. package/lib/browser/monaco-diff-editor.js +74 -74
  48. package/lib/browser/monaco-diff-editor.js.map +1 -1
  49. package/lib/browser/monaco-diff-navigator-factory.d.ts +6 -7
  50. package/lib/browser/monaco-diff-navigator-factory.d.ts.map +1 -1
  51. package/lib/browser/monaco-diff-navigator-factory.js +45 -66
  52. package/lib/browser/monaco-diff-navigator-factory.js.map +1 -1
  53. package/lib/browser/monaco-editor-model.d.ts +158 -156
  54. package/lib/browser/monaco-editor-model.d.ts.map +1 -1
  55. package/lib/browser/monaco-editor-model.js +562 -559
  56. package/lib/browser/monaco-editor-model.js.map +1 -1
  57. package/lib/browser/monaco-editor-provider.d.ts +70 -89
  58. package/lib/browser/monaco-editor-provider.d.ts.map +1 -1
  59. package/lib/browser/monaco-editor-provider.js +386 -440
  60. package/lib/browser/monaco-editor-provider.js.map +1 -1
  61. package/lib/browser/monaco-editor-service.d.ts +32 -27
  62. package/lib/browser/monaco-editor-service.d.ts.map +1 -1
  63. package/lib/browser/monaco-editor-service.js +158 -155
  64. package/lib/browser/monaco-editor-service.js.map +1 -1
  65. package/lib/browser/monaco-editor-zone-widget.d.ts +43 -43
  66. package/lib/browser/monaco-editor-zone-widget.js +194 -194
  67. package/lib/browser/monaco-editor.d.ts +154 -151
  68. package/lib/browser/monaco-editor.d.ts.map +1 -1
  69. package/lib/browser/monaco-editor.js +542 -524
  70. package/lib/browser/monaco-editor.js.map +1 -1
  71. package/lib/browser/monaco-formatting-conflicts.d.ts +13 -13
  72. package/lib/browser/monaco-formatting-conflicts.js +111 -111
  73. package/lib/browser/monaco-formatting-conflicts.js.map +1 -1
  74. package/lib/browser/monaco-frontend-application-contribution.d.ts +22 -28
  75. package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
  76. package/lib/browser/monaco-frontend-application-contribution.js +178 -215
  77. package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
  78. package/lib/browser/monaco-frontend-module.d.ts +7 -7
  79. package/lib/browser/monaco-frontend-module.d.ts.map +1 -1
  80. package/lib/browser/monaco-frontend-module.js +280 -271
  81. package/lib/browser/monaco-frontend-module.js.map +1 -1
  82. package/lib/browser/monaco-gotoline-quick-access.d.ts +11 -11
  83. package/lib/browser/monaco-gotoline-quick-access.js +64 -64
  84. package/lib/browser/monaco-gotosymbol-quick-access.d.ts +16 -16
  85. package/lib/browser/monaco-gotosymbol-quick-access.js +70 -70
  86. package/lib/browser/monaco-icon-registry.d.ts +10 -11
  87. package/lib/browser/monaco-icon-registry.d.ts.map +1 -1
  88. package/lib/browser/monaco-icon-registry.js +52 -50
  89. package/lib/browser/monaco-icon-registry.js.map +1 -1
  90. package/lib/browser/monaco-indexed-db.d.ts +28 -28
  91. package/lib/browser/monaco-indexed-db.js +131 -131
  92. package/lib/browser/monaco-init.d.ts +5 -0
  93. package/lib/browser/monaco-init.d.ts.map +1 -0
  94. package/lib/browser/monaco-init.js +125 -0
  95. package/lib/browser/monaco-init.js.map +1 -0
  96. package/lib/browser/monaco-keybinding.d.ts +16 -16
  97. package/lib/browser/monaco-keybinding.js +134 -134
  98. package/lib/browser/monaco-keybinding.js.map +1 -1
  99. package/lib/browser/monaco-keycode-map.d.ts +2 -2
  100. package/lib/browser/monaco-keycode-map.js +163 -163
  101. package/lib/browser/monaco-keycode-map.js.map +1 -1
  102. package/lib/browser/monaco-languages.d.ts +35 -35
  103. package/lib/browser/monaco-languages.js +180 -180
  104. package/lib/browser/monaco-marker-collection.d.ts +18 -18
  105. package/lib/browser/monaco-marker-collection.js +70 -70
  106. package/lib/browser/monaco-menu.d.ts +20 -20
  107. package/lib/browser/monaco-menu.js +145 -145
  108. package/lib/browser/monaco-mime-service.d.ts +10 -10
  109. package/lib/browser/monaco-mime-service.js +78 -78
  110. package/lib/browser/monaco-outline-contribution.d.ts +78 -78
  111. package/lib/browser/monaco-outline-contribution.js +384 -384
  112. package/lib/browser/monaco-outline-decorator.d.ts +12 -12
  113. package/lib/browser/monaco-outline-decorator.js +67 -67
  114. package/lib/browser/monaco-quick-access-registry.d.ts +11 -11
  115. package/lib/browser/monaco-quick-access-registry.js +99 -99
  116. package/lib/browser/monaco-quick-input-service.d.ts +99 -101
  117. package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
  118. package/lib/browser/monaco-quick-input-service.js +529 -568
  119. package/lib/browser/monaco-quick-input-service.js.map +1 -1
  120. package/lib/browser/monaco-resolved-keybinding.d.ts +23 -23
  121. package/lib/browser/monaco-resolved-keybinding.d.ts.map +1 -1
  122. package/lib/browser/monaco-resolved-keybinding.js +131 -131
  123. package/lib/browser/monaco-resolved-keybinding.js.map +1 -1
  124. package/lib/browser/monaco-snippet-suggest-provider.d.ts +66 -66
  125. package/lib/browser/monaco-snippet-suggest-provider.js +273 -273
  126. package/lib/browser/monaco-status-bar-contribution.d.ts +17 -17
  127. package/lib/browser/monaco-status-bar-contribution.js +121 -121
  128. package/lib/browser/monaco-text-model-service.d.ts +51 -51
  129. package/lib/browser/monaco-text-model-service.js +189 -189
  130. package/lib/browser/monaco-text-model-service.js.map +1 -1
  131. package/lib/browser/monaco-theming-service.d.ts +67 -67
  132. package/lib/browser/monaco-theming-service.js +171 -171
  133. package/lib/browser/monaco-to-protocol-converter.d.ts +26 -26
  134. package/lib/browser/monaco-to-protocol-converter.js +61 -61
  135. package/lib/browser/monaco-workspace.d.ts +83 -85
  136. package/lib/browser/monaco-workspace.d.ts.map +1 -1
  137. package/lib/browser/monaco-workspace.js +384 -384
  138. package/lib/browser/monaco-workspace.js.map +1 -1
  139. package/lib/browser/protocol-to-monaco-converter.d.ts +31 -31
  140. package/lib/browser/protocol-to-monaco-converter.js +133 -133
  141. package/lib/browser/simple-monaco-editor.d.ts +45 -44
  142. package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
  143. package/lib/browser/simple-monaco-editor.js +184 -176
  144. package/lib/browser/simple-monaco-editor.js.map +1 -1
  145. package/lib/browser/textmate/index.d.ts +4 -4
  146. package/lib/browser/textmate/index.js +31 -31
  147. package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +11 -11
  148. package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +91 -91
  149. package/lib/browser/textmate/monaco-textmate-service.d.ts +30 -30
  150. package/lib/browser/textmate/monaco-textmate-service.js +185 -185
  151. package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
  152. package/lib/browser/textmate/monaco-theme-registry.d.ts +27 -27
  153. package/lib/browser/textmate/monaco-theme-registry.js +173 -173
  154. package/lib/browser/textmate/monaco-theme-types.d.ts +20 -20
  155. package/lib/browser/textmate/monaco-theme-types.js +21 -21
  156. package/lib/browser/textmate/textmate-contribution.d.ts +9 -9
  157. package/lib/browser/textmate/textmate-contribution.js +27 -27
  158. package/lib/browser/textmate/textmate-registry.d.ts +31 -31
  159. package/lib/browser/textmate/textmate-registry.js +109 -109
  160. package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts +26 -26
  161. package/lib/browser/textmate/textmate-snippet-completion-provider.js +53 -53
  162. package/lib/browser/textmate/textmate-tokenizer.d.ts +22 -22
  163. package/lib/browser/textmate/textmate-tokenizer.js +65 -65
  164. package/lib/browser/workspace-symbol-command.d.ts +55 -55
  165. package/lib/browser/workspace-symbol-command.js +215 -215
  166. package/lib/package.spec.js +25 -25
  167. package/package.json +10 -10
  168. package/src/browser/index.ts +17 -17
  169. package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +109 -117
  170. package/src/browser/monaco-bulk-edit-service.ts +64 -64
  171. package/src/browser/monaco-color-registry.ts +73 -73
  172. package/src/browser/monaco-command-registry.ts +85 -82
  173. package/src/browser/monaco-command-service.ts +90 -99
  174. package/src/browser/monaco-command.ts +303 -313
  175. package/src/browser/monaco-context-key-service.ts +144 -143
  176. package/src/browser/monaco-context-menu.ts +100 -90
  177. package/src/browser/monaco-diff-editor.ts +100 -101
  178. package/src/browser/monaco-diff-navigator-factory.ts +39 -61
  179. package/src/browser/monaco-editor-model.ts +684 -681
  180. package/src/browser/monaco-editor-provider.ts +409 -452
  181. package/src/browser/monaco-editor-service.ts +149 -144
  182. package/src/browser/monaco-editor-zone-widget.ts +250 -250
  183. package/src/browser/monaco-editor.ts +663 -644
  184. package/src/browser/monaco-formatting-conflicts.ts +116 -116
  185. package/src/browser/monaco-frontend-application-contribution.ts +165 -200
  186. package/src/browser/monaco-frontend-module.ts +328 -320
  187. package/src/browser/monaco-gotoline-quick-access.ts +47 -47
  188. package/src/browser/monaco-gotosymbol-quick-access.ts +53 -53
  189. package/src/browser/monaco-icon-registry.ts +49 -47
  190. package/src/browser/monaco-indexed-db.ts +130 -130
  191. package/src/browser/monaco-init.ts +114 -0
  192. package/src/browser/monaco-keybinding.ts +111 -111
  193. package/src/browser/monaco-keycode-map.ts +171 -171
  194. package/src/browser/monaco-languages.ts +177 -177
  195. package/src/browser/monaco-marker-collection.ts +83 -83
  196. package/src/browser/monaco-menu.ts +142 -142
  197. package/src/browser/monaco-mime-service.ts +71 -71
  198. package/src/browser/monaco-outline-contribution.ts +404 -404
  199. package/src/browser/monaco-outline-decorator.ts +66 -66
  200. package/src/browser/monaco-quick-access-registry.ts +112 -112
  201. package/src/browser/monaco-quick-input-service.ts +647 -676
  202. package/src/browser/monaco-resolved-keybinding.ts +162 -162
  203. package/src/browser/monaco-snippet-suggest-provider.ts +306 -306
  204. package/src/browser/monaco-status-bar-contribution.ts +110 -110
  205. package/src/browser/monaco-text-model-service.ts +199 -199
  206. package/src/browser/monaco-theming-service.ts +204 -204
  207. package/src/browser/monaco-to-protocol-converter.ts +71 -71
  208. package/src/browser/monaco-workspace.ts +412 -412
  209. package/src/browser/protocol-to-monaco-converter.ts +158 -158
  210. package/src/browser/simple-monaco-editor.ts +217 -210
  211. package/src/browser/style/index.css +263 -263
  212. package/src/browser/textmate/index.ts +20 -20
  213. package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +90 -90
  214. package/src/browser/textmate/monaco-textmate-service.ts +187 -187
  215. package/src/browser/textmate/monaco-theme-registry.ts +176 -176
  216. package/src/browser/textmate/monaco-theme-types.ts +37 -37
  217. package/src/browser/textmate/textmate-contribution.ts +29 -29
  218. package/src/browser/textmate/textmate-registry.ts +129 -129
  219. package/src/browser/textmate/textmate-snippet-completion-provider.ts +73 -73
  220. package/src/browser/textmate/textmate-tokenizer.ts +84 -84
  221. package/src/browser/workspace-symbol-command.ts +196 -196
  222. package/src/package.spec.ts +28 -28
@@ -1,569 +1,530 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
- return c > 3 && r && Object.defineProperty(target, key, r), r;
22
- };
23
- var __metadata = (this && this.__metadata) || function (k, v) {
24
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
- };
26
- Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.MonacoQuickPickItem = exports.MonacoQuickInputService = exports.MonacoQuickInputImplementation = void 0;
28
- const browser_1 = require("@theia/core/lib/browser");
29
- const inversify_1 = require("@theia/core/shared/inversify");
30
- const quickInput_1 = require("@theia/monaco-editor-core/esm/vs/base/parts/quickinput/browser/quickInput");
31
- const monaco_resolved_keybinding_1 = require("./monaco-resolved-keybinding");
32
- const quickAccess_1 = require("@theia/monaco-editor-core/esm/vs/platform/quickinput/browser/quickAccess");
33
- const contextKeyService_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/browser/contextKeyService");
34
- const listWidget_1 = require("@theia/monaco-editor-core/esm/vs/base/browser/ui/list/listWidget");
35
- const instantiation_1 = require("@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation");
36
- const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
37
- const core_1 = require("@theia/core");
38
- const monaco_color_registry_1 = require("./monaco-color-registry");
39
- const theming_1 = require("@theia/core/lib/browser/theming");
40
- const standaloneTheme_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme");
41
- const themeService_1 = require("@theia/monaco-editor-core/esm/vs/platform/theme/common/themeService");
42
- let MonacoQuickInputImplementation = class MonacoQuickInputImplementation {
43
- get backButton() { return this.controller.backButton; }
44
- get onShow() { return this.controller.onShow; }
45
- get onHide() { return this.controller.onHide; }
46
- init() {
47
- this.initContainer();
48
- this.initController();
49
- this.quickAccess = new quickAccess_1.QuickAccessController(this, standaloneServices_1.StandaloneServices.get(instantiation_1.IInstantiationService));
50
- this.inQuickOpen = this.contextKeyService.createKey('inQuickOpen', false);
51
- this.controller.onShow(() => {
52
- this.container.style.top = this.shell.mainPanel.node.getBoundingClientRect().top + 'px';
53
- this.inQuickOpen.set(true);
54
- });
55
- this.controller.onHide(() => this.inQuickOpen.set(false));
56
- this.themeService.initialized.then(() => this.controller.applyStyles(this.getStyles()));
57
- // Hook into the theming service of Monaco to ensure that the updates are ready.
58
- standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService).onDidColorThemeChange(() => this.controller.applyStyles(this.getStyles()));
59
- window.addEventListener('resize', () => this.updateLayout());
60
- }
61
- setContextKey(key) {
62
- if (key) {
63
- this.contextKeyService.createKey(key, undefined);
64
- }
65
- }
66
- createQuickPick() {
67
- return this.controller.createQuickPick();
68
- }
69
- createInputBox() {
70
- return this.controller.createInputBox();
71
- }
72
- open(filter) {
73
- this.quickAccess.show(filter);
74
- setTimeout(() => {
75
- this.quickInputList.focusNth(0);
76
- }, 300);
77
- }
78
- input(options, token) {
79
- return this.controller.input(options, token);
80
- }
81
- pick(picks, options, token) {
82
- return this.controller.pick(picks, options, token);
83
- }
84
- hide() {
85
- this.controller.hide();
86
- }
87
- focus() {
88
- this.controller.focus();
89
- }
90
- toggle() {
91
- this.controller.toggle();
92
- }
93
- applyStyles(styles) {
94
- this.controller.applyStyles(styles);
95
- }
96
- layout(dimension, titleBarOffset) {
97
- this.controller.layout(dimension, titleBarOffset);
98
- }
99
- navigate(next, quickNavigate) {
100
- this.controller.navigate(next, quickNavigate);
101
- }
102
- dispose() {
103
- this.controller.dispose();
104
- }
105
- async cancel() {
106
- this.controller.cancel();
107
- }
108
- async back() {
109
- this.controller.back();
110
- }
111
- async accept(keyMods) {
112
- this.controller.accept(keyMods);
113
- }
114
- initContainer() {
115
- const container = this.container = document.createElement('div');
116
- container.id = 'quick-input-container';
117
- document.body.appendChild(this.container);
118
- }
119
- initController() {
120
- this.controller = new quickInput_1.QuickInputController(this.getOptions());
121
- this.updateLayout();
122
- }
123
- updateLayout() {
124
- // Initialize the layout using screen dimensions as monaco computes the actual sizing.
125
- // https://github.com/microsoft/vscode/blob/6261075646f055b99068d3688932416f2346dd3b/src/vs/base/parts/quickinput/browser/quickInput.ts#L1799
126
- this.controller.layout(this.getClientDimension(), 0);
127
- }
128
- getClientDimension() {
129
- return { width: window.innerWidth, height: window.innerHeight };
130
- }
131
- getOptions() {
132
- const options = {
133
- idPrefix: 'quickInput_',
134
- container: this.container,
135
- styles: { widget: {}, list: {}, inputBox: {}, countBadge: {}, button: {}, progressBar: {}, keybindingLabel: {}, },
136
- ignoreFocusOut: () => false,
137
- isScreenReaderOptimized: () => false,
138
- backKeybindingLabel: () => undefined,
139
- setContextKey: (id) => this.setContextKey(id),
140
- returnFocus: () => this.container.focus(),
141
- createList: (user, container, delegate, renderers, listOptions) => this.quickInputList = new listWidget_1.List(user, container, delegate, renderers, listOptions),
142
- };
143
- return options;
144
- }
145
- // @monaco-uplift
146
- // Keep the styles up to date with https://github.com/microsoft/vscode/blob/7888ff3a6b104e9e2e3d0f7890ca92dd0828215f/src/vs/platform/quickinput/browser/quickInput.ts#L171.
147
- getStyles() {
148
- return {
149
- widget: {
150
- quickInputBackground: this.colorRegistry.getColor('quickInput.background'),
151
- quickInputForeground: this.colorRegistry.getColor('quickInput.foreground'),
152
- quickInputTitleBackground: this.colorRegistry.getColor('quickInputTitle.background')
153
- },
154
- list: {
155
- listBackground: this.colorRegistry.getColor('quickInput.background'),
156
- listInactiveFocusForeground: this.colorRegistry.getColor('quickInputList.focusForeground'),
157
- listInactiveSelectionIconForeground: this.colorRegistry.getColor('quickInputList.focusIconForeground'),
158
- listInactiveFocusBackground: this.colorRegistry.getColor('quickInputList.focusBackground'),
159
- listFocusOutline: this.colorRegistry.getColor('activeContrastBorder'),
160
- listInactiveFocusOutline: this.colorRegistry.getColor('activeContrastBorder'),
161
- pickerGroupBorder: this.colorRegistry.getColor('pickerGroup.border'),
162
- pickerGroupForeground: this.colorRegistry.getColor('pickerGroup.foreground')
163
- },
164
- inputBox: {
165
- inputForeground: this.colorRegistry.getColor('inputForeground'),
166
- inputBackground: this.colorRegistry.getColor('inputBackground'),
167
- inputBorder: this.colorRegistry.getColor('inputBorder'),
168
- inputValidationInfoBackground: this.colorRegistry.getColor('inputValidation.infoBackground'),
169
- inputValidationInfoForeground: this.colorRegistry.getColor('inputValidation.infoForeground'),
170
- inputValidationInfoBorder: this.colorRegistry.getColor('inputValidation.infoBorder'),
171
- inputValidationWarningBackground: this.colorRegistry.getColor('inputValidation.warningBackground'),
172
- inputValidationWarningForeground: this.colorRegistry.getColor('inputValidation.warningForeground'),
173
- inputValidationWarningBorder: this.colorRegistry.getColor('inputValidation.warningBorder'),
174
- inputValidationErrorBackground: this.colorRegistry.getColor('inputValidation.errorBackground'),
175
- inputValidationErrorForeground: this.colorRegistry.getColor('inputValidation.errorForeground'),
176
- inputValidationErrorBorder: this.colorRegistry.getColor('inputValidation.errorBorder'),
177
- },
178
- countBadge: {
179
- badgeBackground: this.colorRegistry.getColor('badge.background'),
180
- badgeForeground: this.colorRegistry.getColor('badge.foreground'),
181
- badgeBorder: this.colorRegistry.getColor('contrastBorder')
182
- },
183
- button: {
184
- buttonForeground: this.colorRegistry.getColor('button.foreground'),
185
- buttonBackground: this.colorRegistry.getColor('button.background'),
186
- buttonHoverBackground: this.colorRegistry.getColor('button.hoverBackground'),
187
- buttonBorder: this.colorRegistry.getColor('contrastBorder')
188
- },
189
- progressBar: {
190
- progressBarBackground: this.colorRegistry.getColor('progressBar.background')
191
- },
192
- keybindingLabel: {
193
- keybindingLabelBackground: this.colorRegistry.getColor('keybindingLabe.background'),
194
- keybindingLabelForeground: this.colorRegistry.getColor('keybindingLabel.foreground'),
195
- keybindingLabelBorder: this.colorRegistry.getColor('keybindingLabel.border'),
196
- keybindingLabelBottomBorder: this.colorRegistry.getColor('keybindingLabel.bottomBorder'),
197
- keybindingLabelShadow: this.colorRegistry.getColor('widget.shadow')
198
- },
199
- };
200
- }
201
- };
202
- __decorate([
203
- (0, inversify_1.inject)(browser_1.ApplicationShell),
204
- __metadata("design:type", browser_1.ApplicationShell)
205
- ], MonacoQuickInputImplementation.prototype, "shell", void 0);
206
- __decorate([
207
- (0, inversify_1.inject)(monaco_color_registry_1.MonacoColorRegistry),
208
- __metadata("design:type", monaco_color_registry_1.MonacoColorRegistry)
209
- ], MonacoQuickInputImplementation.prototype, "colorRegistry", void 0);
210
- __decorate([
211
- (0, inversify_1.inject)(theming_1.ThemeService),
212
- __metadata("design:type", theming_1.ThemeService)
213
- ], MonacoQuickInputImplementation.prototype, "themeService", void 0);
214
- __decorate([
215
- (0, inversify_1.inject)(contextKeyService_1.ContextKeyService),
216
- __metadata("design:type", contextKeyService_1.ContextKeyService)
217
- ], MonacoQuickInputImplementation.prototype, "contextKeyService", void 0);
218
- __decorate([
219
- (0, inversify_1.postConstruct)(),
220
- __metadata("design:type", Function),
221
- __metadata("design:paramtypes", []),
222
- __metadata("design:returntype", void 0)
223
- ], MonacoQuickInputImplementation.prototype, "init", null);
224
- MonacoQuickInputImplementation = __decorate([
225
- (0, inversify_1.injectable)()
226
- ], MonacoQuickInputImplementation);
227
- exports.MonacoQuickInputImplementation = MonacoQuickInputImplementation;
228
- let MonacoQuickInputService = class MonacoQuickInputService {
229
- get backButton() {
230
- return this.monacoService.backButton;
231
- }
232
- get onShow() { return this.monacoService.onShow; }
233
- get onHide() { return this.monacoService.onHide; }
234
- open(filter) {
235
- this.monacoService.open(filter);
236
- }
237
- createInputBox() {
238
- return this.monacoService.createInputBox();
239
- }
240
- input(options, token) {
241
- let inputOptions;
242
- if (options) {
243
- const { validateInput, ...props } = options;
244
- inputOptions = { ...props };
245
- if (validateInput) {
246
- inputOptions.validateInput = async (input) => validateInput(input);
247
- }
248
- }
249
- return this.monacoService.input(inputOptions, token);
250
- }
251
- async pick(picks, options, token) {
252
- const monacoPicks = new Promise(async (resolve) => {
253
- const updatedPicks = (await picks).map(pick => {
254
- if (pick.type !== 'separator') {
255
- const icon = pick.iconPath;
256
- // @monaco-uplift
257
- // Other kind of icons (URI and URI dark/light) shall be supported once monaco editor has been upgraded to at least 1.81.
258
- // see https://github.com/eclipse-theia/theia/pull/12945#issue-1913645228
259
- if (themeService_1.ThemeIcon.isThemeIcon(icon)) {
260
- const codicon = (0, browser_1.codiconArray)(icon.id);
261
- if (pick.iconClasses) {
262
- pick.iconClasses.push(...codicon);
263
- }
264
- else {
265
- pick.iconClasses = codicon;
266
- }
267
- }
268
- pick.buttons && (pick.buttons = pick.buttons.map(browser_1.QuickInputButton.normalize));
269
- }
270
- return pick;
271
- });
272
- resolve(updatedPicks);
273
- });
274
- const monacoOptions = options;
275
- const picked = await this.monacoService.pick(monacoPicks, monacoOptions, token);
276
- if (!picked) {
277
- return picked;
278
- }
279
- if (options === null || options === void 0 ? void 0 : options.canPickMany) {
280
- return (Array.isArray(picked) ? picked : [picked]);
281
- }
282
- return Array.isArray(picked) ? picked[0] : picked;
283
- }
284
- showQuickPick(items, options) {
285
- return new Promise((resolve, reject) => {
286
- var _a, _b, _c, _d;
287
- const wrapped = this.createQuickPick();
288
- wrapped.items = items;
289
- if (options) {
290
- wrapped.canSelectMany = !!options.canSelectMany;
291
- wrapped.contextKey = options.contextKey;
292
- wrapped.description = options.description;
293
- wrapped.enabled = (_a = options.enabled) !== null && _a !== void 0 ? _a : true;
294
- wrapped.ignoreFocusOut = !!options.ignoreFocusOut;
295
- wrapped.matchOnDescription = (_b = options.matchOnDescription) !== null && _b !== void 0 ? _b : true;
296
- wrapped.matchOnDetail = (_c = options.matchOnDetail) !== null && _c !== void 0 ? _c : true;
297
- wrapped.keepScrollPosition = (_d = options.keepScrollPosition) !== null && _d !== void 0 ? _d : false;
298
- wrapped.placeholder = options.placeholder;
299
- wrapped.step = options.step;
300
- wrapped.title = options.title;
301
- wrapped.totalSteps = options.totalSteps;
302
- if (options.activeItem) {
303
- wrapped.activeItems = [options.activeItem];
304
- }
305
- wrapped.onDidAccept(() => {
306
- if (options === null || options === void 0 ? void 0 : options.onDidAccept) {
307
- options.onDidAccept();
308
- }
309
- wrapped.hide();
310
- resolve(wrapped.selectedItems[0]);
311
- });
312
- wrapped.onDidHide(() => {
313
- if (options.onDidHide) {
314
- options.onDidHide();
315
- }
316
- ;
317
- wrapped.dispose();
318
- setTimeout(() => resolve(undefined));
319
- });
320
- wrapped.onDidChangeValue((filter) => {
321
- if (options.onDidChangeValue) {
322
- options.onDidChangeValue(wrapped, filter);
323
- }
324
- });
325
- wrapped.onDidChangeActive((activeItems) => {
326
- if (options.onDidChangeActive) {
327
- options.onDidChangeActive(wrapped, activeItems);
328
- }
329
- });
330
- wrapped.onDidTriggerButton((button) => {
331
- if (options.onDidTriggerButton) {
332
- options.onDidTriggerButton(button);
333
- }
334
- });
335
- wrapped.onDidTriggerItemButton((event) => {
336
- if (options.onDidTriggerItemButton) {
337
- // https://github.com/theia-ide/vscode/blob/standalone/0.23.x/src/vs/base/parts/quickinput/browser/quickInput.ts#L1387
338
- options.onDidTriggerItemButton({
339
- ...event,
340
- removeItem: () => {
341
- wrapped.items = wrapped.items.filter(item => item !== event.item);
342
- wrapped.activeItems = wrapped.activeItems.filter(item => item !== event.item);
343
- }
344
- });
345
- }
346
- });
347
- wrapped.onDidChangeSelection((selectedItems) => {
348
- if (options.onDidChangeSelection) {
349
- options.onDidChangeSelection(wrapped, selectedItems);
350
- }
351
- });
352
- }
353
- wrapped.show();
354
- }).then(item => {
355
- if (item === null || item === void 0 ? void 0 : item.execute) {
356
- item.execute();
357
- }
358
- return item;
359
- });
360
- }
361
- createQuickPick() {
362
- const quickPick = this.monacoService.createQuickPick();
363
- return this.wrapQuickPick(quickPick);
364
- }
365
- wrapQuickPick(wrapped) {
366
- return new MonacoQuickPick(wrapped, this.keybindingRegistry);
367
- }
368
- convertItems(item) {
369
- return new MonacoQuickPickItem(item, this.keybindingRegistry);
370
- }
371
- hide() {
372
- return this.monacoService.hide();
373
- }
374
- };
375
- __decorate([
376
- (0, inversify_1.inject)(MonacoQuickInputImplementation),
377
- __metadata("design:type", MonacoQuickInputImplementation)
378
- ], MonacoQuickInputService.prototype, "monacoService", void 0);
379
- __decorate([
380
- (0, inversify_1.inject)(browser_1.KeybindingRegistry),
381
- __metadata("design:type", browser_1.KeybindingRegistry)
382
- ], MonacoQuickInputService.prototype, "keybindingRegistry", void 0);
383
- MonacoQuickInputService = __decorate([
384
- (0, inversify_1.injectable)()
385
- ], MonacoQuickInputService);
386
- exports.MonacoQuickInputService = MonacoQuickInputService;
387
- class MonacoQuickInput {
388
- constructor(wrapped) {
389
- this.wrapped = wrapped;
390
- }
391
- get onDidHide() { return this.wrapped.onDidHide; }
392
- get onDispose() { return this.wrapped.onDispose; }
393
- get title() {
394
- return this.wrapped.title;
395
- }
396
- set title(v) {
397
- this.wrapped.title = v;
398
- }
399
- get description() {
400
- return this.wrapped.description;
401
- }
402
- set description(v) {
403
- this.wrapped.description = v;
404
- }
405
- get step() {
406
- return this.wrapped.step;
407
- }
408
- set step(v) {
409
- this.wrapped.step = v;
410
- }
411
- get enabled() {
412
- return this.wrapped.enabled;
413
- }
414
- set enabled(v) {
415
- this.wrapped.enabled = v;
416
- }
417
- get totalSteps() {
418
- return this.wrapped.totalSteps;
419
- }
420
- set totalSteps(v) {
421
- this.wrapped.totalSteps = v;
422
- }
423
- get contextKey() {
424
- return this.wrapped.contextKey;
425
- }
426
- set contextKey(v) {
427
- this.wrapped.contextKey = v;
428
- }
429
- get busy() {
430
- return this.wrapped.busy;
431
- }
432
- set busy(v) {
433
- this.wrapped.busy = v;
434
- }
435
- get ignoreFocusOut() {
436
- return this.wrapped.ignoreFocusOut;
437
- }
438
- set ignoreFocusOut(v) {
439
- this.wrapped.ignoreFocusOut = v;
440
- }
441
- show() {
442
- this.wrapped.show();
443
- }
444
- hide() {
445
- this.wrapped.hide();
446
- }
447
- dispose() {
448
- this.wrapped.dispose();
449
- }
450
- }
451
- class MonacoQuickPick extends MonacoQuickInput {
452
- constructor(wrapped, keybindingRegistry) {
453
- super(wrapped);
454
- this.wrapped = wrapped;
455
- this.keybindingRegistry = keybindingRegistry;
456
- this.onDidAccept = this.wrapped.onDidAccept;
457
- this.onDidChangeValue = this.wrapped.onDidChangeValue;
458
- this.onDidTriggerButton = this.wrapped.onDidTriggerButton;
459
- this.onDidTriggerItemButton = core_1.Event.map(this.wrapped.onDidTriggerItemButton, (evt) => ({
460
- item: evt.item.item,
461
- button: evt.button
462
- }));
463
- this.onDidChangeActive = core_1.Event.map(this.wrapped.onDidChangeActive, (items) => items.map(item => item.item));
464
- this.onDidChangeSelection = core_1.Event.map(this.wrapped.onDidChangeSelection, (items) => items.map(item => item.item));
465
- }
466
- get value() {
467
- return this.wrapped.value;
468
- }
469
- ;
470
- set value(v) {
471
- this.wrapped.value = v;
472
- }
473
- get placeholder() {
474
- return this.wrapped.placeholder;
475
- }
476
- set placeholder(v) {
477
- this.wrapped.placeholder = v;
478
- }
479
- get canSelectMany() {
480
- return this.wrapped.canSelectMany;
481
- }
482
- set canSelectMany(v) {
483
- this.wrapped.canSelectMany = v;
484
- }
485
- get matchOnDescription() {
486
- return this.wrapped.matchOnDescription;
487
- }
488
- set matchOnDescription(v) {
489
- this.wrapped.matchOnDescription = v;
490
- }
491
- get matchOnDetail() {
492
- return this.wrapped.matchOnDetail;
493
- }
494
- set matchOnDetail(v) {
495
- this.wrapped.matchOnDetail = v;
496
- }
497
- get keepScrollPosition() {
498
- return this.wrapped.keepScrollPosition;
499
- }
500
- set keepScrollPosition(v) {
501
- this.wrapped.keepScrollPosition = v;
502
- }
503
- get items() {
504
- return this.wrapped.items.map(item => browser_1.QuickPickSeparator.is(item) ? item : item.item);
505
- }
506
- set items(itemList) {
507
- // We need to store and apply the currently selected active items.
508
- // Since monaco compares these items by reference equality, creating new wrapped items will unmark any active items.
509
- // Assigning the `activeItems` again will restore all active items even after the items array has changed.
510
- // See also the `findMonacoItemReferences` method.
511
- const active = this.activeItems;
512
- this.wrapped.items = itemList.map(item => browser_1.QuickPickSeparator.is(item) ? item : new MonacoQuickPickItem(item, this.keybindingRegistry));
513
- if (active.length !== 0) {
514
- this.activeItems = active; // If this is done with an empty activeItems array, then it will undo first item focus on quick menus.
515
- }
516
- }
517
- set activeItems(itemList) {
518
- this.wrapped.activeItems = this.findMonacoItemReferences(this.wrapped.items, itemList);
519
- }
520
- get activeItems() {
521
- return this.wrapped.activeItems.map(item => item.item);
522
- }
523
- set selectedItems(itemList) {
524
- this.wrapped.selectedItems = this.findMonacoItemReferences(this.wrapped.items, itemList);
525
- }
526
- get selectedItems() {
527
- return this.wrapped.selectedItems.map(item => item.item);
528
- }
529
- /**
530
- * Monaco doesn't check for deep equality when setting the `activeItems` or `selectedItems`.
531
- * Instead we have to find the references of the monaco wrappers that contain the selected/active items
532
- */
533
- findMonacoItemReferences(source, items) {
534
- const monacoReferences = [];
535
- for (const item of items) {
536
- for (const wrappedItem of source) {
537
- if (!browser_1.QuickPickSeparator.is(wrappedItem) && wrappedItem.item === item) {
538
- monacoReferences.push(wrappedItem);
539
- }
540
- }
541
- }
542
- return monacoReferences;
543
- }
544
- }
545
- class MonacoQuickPickItem {
546
- constructor(item, kbRegistry) {
547
- var _a;
548
- this.item = item;
549
- this.type = item.type;
550
- this.id = item.id;
551
- this.label = item.label;
552
- this.meta = item.meta;
553
- this.ariaLabel = item.ariaLabel;
554
- this.description = item.description;
555
- this.detail = item.detail;
556
- this.keybinding = item.keySequence ? new monaco_resolved_keybinding_1.MonacoResolvedKeybinding(item.keySequence, kbRegistry) : undefined;
557
- this.iconClasses = item.iconClasses;
558
- this.buttons = (_a = item.buttons) === null || _a === void 0 ? void 0 : _a.map(browser_1.QuickInputButton.normalize);
559
- this.alwaysShow = item.alwaysShow;
560
- this.highlights = item.highlights;
561
- }
562
- accept() {
563
- if (this.item.execute) {
564
- this.item.execute();
565
- }
566
- }
567
- }
568
- exports.MonacoQuickPickItem = MonacoQuickPickItem;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __metadata = (this && this.__metadata) || function (k, v) {
24
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25
+ };
26
+ Object.defineProperty(exports, "__esModule", { value: true });
27
+ exports.MonacoQuickPickItem = exports.MonacoQuickInputService = exports.MonacoQuickInputImplementation = void 0;
28
+ const browser_1 = require("@theia/core/lib/browser");
29
+ const inversify_1 = require("@theia/core/shared/inversify");
30
+ const quickInputController_1 = require("@theia/monaco-editor-core/esm/vs/platform/quickinput/browser/quickInputController");
31
+ const monaco_resolved_keybinding_1 = require("./monaco-resolved-keybinding");
32
+ const quickAccess_1 = require("@theia/monaco-editor-core/esm/vs/platform/quickinput/browser/quickAccess");
33
+ const contextkey_1 = require("@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey");
34
+ const listWidget_1 = require("@theia/monaco-editor-core/esm/vs/base/browser/ui/list/listWidget");
35
+ const instantiation_1 = require("@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation");
36
+ const standaloneServices_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices");
37
+ const core_1 = require("@theia/core");
38
+ const monaco_color_registry_1 = require("./monaco-color-registry");
39
+ const theming_1 = require("@theia/core/lib/browser/theming");
40
+ const standaloneTheme_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme");
41
+ const colorRegistry_1 = require("@theia/monaco-editor-core/esm/vs/platform/theme/common/colorRegistry");
42
+ const defaultStyles_1 = require("@theia/monaco-editor-core/esm/vs/platform/theme/browser/defaultStyles");
43
+ let MonacoQuickInputImplementation = class MonacoQuickInputImplementation {
44
+ get backButton() { return this.controller.backButton; }
45
+ get onShow() { return this.controller.onShow; }
46
+ get onHide() { return this.controller.onHide; }
47
+ init() {
48
+ this.initContainer();
49
+ this.initController();
50
+ this.quickAccess = new quickAccess_1.QuickAccessController(this, standaloneServices_1.StandaloneServices.get(instantiation_1.IInstantiationService));
51
+ this.inQuickOpen = standaloneServices_1.StandaloneServices.get(contextkey_1.IContextKeyService).createKey('inQuickOpen', false);
52
+ this.controller.onShow(() => {
53
+ this.container.style.top = this.shell.mainPanel.node.getBoundingClientRect().top + 'px';
54
+ this.inQuickOpen.set(true);
55
+ });
56
+ this.controller.onHide(() => this.inQuickOpen.set(false));
57
+ this.themeService.initialized.then(() => this.controller.applyStyles(this.computeStyles()));
58
+ // Hook into the theming service of Monaco to ensure that the updates are ready.
59
+ standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService).onDidColorThemeChange(() => this.controller.applyStyles(this.computeStyles()));
60
+ window.addEventListener('resize', () => this.updateLayout());
61
+ }
62
+ setContextKey(key) {
63
+ if (key) {
64
+ standaloneServices_1.StandaloneServices.get(contextkey_1.IContextKeyService).createKey(key, undefined);
65
+ }
66
+ }
67
+ createQuickWidget() {
68
+ return this.controller.createQuickWidget();
69
+ }
70
+ createQuickPick() {
71
+ return this.controller.createQuickPick();
72
+ }
73
+ createInputBox() {
74
+ return this.controller.createInputBox();
75
+ }
76
+ open(filter) {
77
+ this.quickAccess.show(filter);
78
+ setTimeout(() => {
79
+ this.quickInputList.focusNth(0);
80
+ }, 300);
81
+ }
82
+ input(options, token) {
83
+ return this.controller.input(options, token);
84
+ }
85
+ pick(picks, options, token) {
86
+ return this.controller.pick(picks, options, token);
87
+ }
88
+ hide() {
89
+ this.controller.hide();
90
+ }
91
+ focus() {
92
+ this.controller.focus();
93
+ }
94
+ toggle() {
95
+ this.controller.toggle();
96
+ }
97
+ applyStyles(styles) {
98
+ this.controller.applyStyles(styles);
99
+ }
100
+ layout(dimension, titleBarOffset) {
101
+ this.controller.layout(dimension, titleBarOffset);
102
+ }
103
+ navigate(next, quickNavigate) {
104
+ this.controller.navigate(next, quickNavigate);
105
+ }
106
+ dispose() {
107
+ this.controller.dispose();
108
+ }
109
+ async cancel() {
110
+ this.controller.cancel();
111
+ }
112
+ async back() {
113
+ this.controller.back();
114
+ }
115
+ async accept(keyMods) {
116
+ this.controller.accept(keyMods);
117
+ }
118
+ initContainer() {
119
+ const container = this.container = document.createElement('div');
120
+ container.id = 'quick-input-container';
121
+ document.body.appendChild(this.container);
122
+ }
123
+ initController() {
124
+ this.controller = new quickInputController_1.QuickInputController(this.getOptions(), standaloneServices_1.StandaloneServices.get(standaloneTheme_1.IStandaloneThemeService));
125
+ this.updateLayout();
126
+ }
127
+ updateLayout() {
128
+ // Initialize the layout using screen dimensions as monaco computes the actual sizing.
129
+ // https://github.com/microsoft/vscode/blob/6261075646f055b99068d3688932416f2346dd3b/src/vs/base/parts/quickinput/browser/quickInput.ts#L1799
130
+ this.controller.layout(this.getClientDimension(), 0);
131
+ }
132
+ getClientDimension() {
133
+ return { width: window.innerWidth, height: window.innerHeight };
134
+ }
135
+ getOptions() {
136
+ const options = {
137
+ idPrefix: 'quickInput_',
138
+ container: this.container,
139
+ styles: this.computeStyles(),
140
+ ignoreFocusOut: () => false,
141
+ backKeybindingLabel: () => undefined,
142
+ setContextKey: (id) => this.setContextKey(id),
143
+ returnFocus: () => this.container.focus(),
144
+ createList: (user, container, delegate, renderers, listOptions) => this.quickInputList = new listWidget_1.List(user, container, delegate, renderers, listOptions),
145
+ linkOpenerDelegate: () => {
146
+ // @monaco-uplift: not sure what to do here
147
+ }
148
+ };
149
+ return options;
150
+ }
151
+ // @monaco-uplift
152
+ // Keep the styles up to date with https://github.com/microsoft/vscode/blob/7888ff3a6b104e9e2e3d0f7890ca92dd0828215f/src/vs/platform/quickinput/browser/quickInput.ts#L171.
153
+ computeStyles() {
154
+ return {
155
+ widget: {
156
+ quickInputBackground: (0, colorRegistry_1.asCssVariable)(colorRegistry_1.quickInputBackground),
157
+ quickInputForeground: (0, colorRegistry_1.asCssVariable)(colorRegistry_1.quickInputForeground),
158
+ quickInputTitleBackground: (0, colorRegistry_1.asCssVariable)(colorRegistry_1.quickInputTitleBackground),
159
+ widgetBorder: (0, colorRegistry_1.asCssVariable)(colorRegistry_1.widgetBorder),
160
+ widgetShadow: (0, colorRegistry_1.asCssVariable)(colorRegistry_1.widgetShadow),
161
+ },
162
+ inputBox: defaultStyles_1.defaultInputBoxStyles,
163
+ toggle: defaultStyles_1.defaultToggleStyles,
164
+ countBadge: defaultStyles_1.defaultCountBadgeStyles,
165
+ button: defaultStyles_1.defaultButtonStyles,
166
+ progressBar: defaultStyles_1.defaultProgressBarStyles,
167
+ keybindingLabel: defaultStyles_1.defaultKeybindingLabelStyles,
168
+ list: (0, defaultStyles_1.getListStyles)({
169
+ listBackground: colorRegistry_1.quickInputBackground,
170
+ listFocusBackground: colorRegistry_1.quickInputListFocusBackground,
171
+ listFocusForeground: colorRegistry_1.quickInputListFocusForeground,
172
+ // Look like focused when inactive.
173
+ listInactiveFocusForeground: colorRegistry_1.quickInputListFocusForeground,
174
+ listInactiveSelectionIconForeground: colorRegistry_1.quickInputListFocusIconForeground,
175
+ listInactiveFocusBackground: colorRegistry_1.quickInputListFocusBackground,
176
+ listFocusOutline: colorRegistry_1.activeContrastBorder,
177
+ listInactiveFocusOutline: colorRegistry_1.activeContrastBorder,
178
+ }),
179
+ pickerGroup: {
180
+ pickerGroupBorder: (0, colorRegistry_1.asCssVariable)(colorRegistry_1.pickerGroupBorder),
181
+ pickerGroupForeground: (0, colorRegistry_1.asCssVariable)(colorRegistry_1.pickerGroupForeground),
182
+ }
183
+ };
184
+ }
185
+ };
186
+ __decorate([
187
+ (0, inversify_1.inject)(browser_1.ApplicationShell),
188
+ __metadata("design:type", browser_1.ApplicationShell)
189
+ ], MonacoQuickInputImplementation.prototype, "shell", void 0);
190
+ __decorate([
191
+ (0, inversify_1.inject)(monaco_color_registry_1.MonacoColorRegistry),
192
+ __metadata("design:type", monaco_color_registry_1.MonacoColorRegistry)
193
+ ], MonacoQuickInputImplementation.prototype, "colorRegistry", void 0);
194
+ __decorate([
195
+ (0, inversify_1.inject)(theming_1.ThemeService),
196
+ __metadata("design:type", theming_1.ThemeService)
197
+ ], MonacoQuickInputImplementation.prototype, "themeService", void 0);
198
+ __decorate([
199
+ (0, inversify_1.postConstruct)(),
200
+ __metadata("design:type", Function),
201
+ __metadata("design:paramtypes", []),
202
+ __metadata("design:returntype", void 0)
203
+ ], MonacoQuickInputImplementation.prototype, "init", null);
204
+ MonacoQuickInputImplementation = __decorate([
205
+ (0, inversify_1.injectable)()
206
+ ], MonacoQuickInputImplementation);
207
+ exports.MonacoQuickInputImplementation = MonacoQuickInputImplementation;
208
+ let MonacoQuickInputService = class MonacoQuickInputService {
209
+ get backButton() {
210
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
211
+ return this.monacoService.backButton;
212
+ }
213
+ get onShow() { return this.monacoService.onShow; }
214
+ get onHide() { return this.monacoService.onHide; }
215
+ open(filter) {
216
+ this.monacoService.open(filter);
217
+ }
218
+ createInputBox() {
219
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
220
+ return this.monacoService.createInputBox();
221
+ }
222
+ input(options, token) {
223
+ let inputOptions;
224
+ if (options) {
225
+ const { validateInput, ...props } = options;
226
+ inputOptions = { ...props };
227
+ if (validateInput) {
228
+ inputOptions.validateInput = async (input) => validateInput(input);
229
+ }
230
+ }
231
+ return this.monacoService.input(inputOptions, token);
232
+ }
233
+ async pick(picks, options, token) {
234
+ return this.monacoService.pick(picks, options, token);
235
+ }
236
+ showQuickPick(items, options) {
237
+ return new Promise((resolve, reject) => {
238
+ var _a, _b, _c, _d;
239
+ const wrapped = this.createQuickPick();
240
+ wrapped.items = items;
241
+ if (options) {
242
+ wrapped.canSelectMany = !!options.canSelectMany;
243
+ wrapped.contextKey = options.contextKey;
244
+ wrapped.description = options.description;
245
+ wrapped.enabled = (_a = options.enabled) !== null && _a !== void 0 ? _a : true;
246
+ wrapped.ignoreFocusOut = !!options.ignoreFocusOut;
247
+ wrapped.matchOnDescription = (_b = options.matchOnDescription) !== null && _b !== void 0 ? _b : true;
248
+ wrapped.matchOnDetail = (_c = options.matchOnDetail) !== null && _c !== void 0 ? _c : true;
249
+ wrapped.keepScrollPosition = (_d = options.keepScrollPosition) !== null && _d !== void 0 ? _d : false;
250
+ wrapped.placeholder = options.placeholder;
251
+ wrapped.step = options.step;
252
+ wrapped.title = options.title;
253
+ wrapped.totalSteps = options.totalSteps;
254
+ if (options.activeItem) {
255
+ wrapped.activeItems = [options.activeItem];
256
+ }
257
+ wrapped.onDidAccept(() => {
258
+ if (options === null || options === void 0 ? void 0 : options.onDidAccept) {
259
+ options.onDidAccept();
260
+ }
261
+ wrapped.hide();
262
+ resolve(wrapped.selectedItems[0]);
263
+ });
264
+ wrapped.onDidHide(() => {
265
+ if (options.onDidHide) {
266
+ options.onDidHide();
267
+ }
268
+ ;
269
+ wrapped.dispose();
270
+ setTimeout(() => resolve(undefined));
271
+ });
272
+ wrapped.onDidChangeValue((filter) => {
273
+ if (options.onDidChangeValue) {
274
+ options.onDidChangeValue(wrapped, filter);
275
+ }
276
+ });
277
+ wrapped.onDidChangeActive((activeItems) => {
278
+ if (options.onDidChangeActive) {
279
+ options.onDidChangeActive(wrapped, activeItems);
280
+ }
281
+ });
282
+ wrapped.onDidTriggerButton((button) => {
283
+ if (options.onDidTriggerButton) {
284
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
285
+ options.onDidTriggerButton(button);
286
+ }
287
+ });
288
+ wrapped.onDidTriggerItemButton((event) => {
289
+ if (options.onDidTriggerItemButton) {
290
+ // https://github.com/theia-ide/vscode/blob/standalone/0.23.x/src/vs/base/parts/quickinput/browser/quickInput.ts#L1387
291
+ options.onDidTriggerItemButton({
292
+ ...event,
293
+ removeItem: () => {
294
+ wrapped.items = wrapped.items.filter(item => item !== event.item);
295
+ wrapped.activeItems = wrapped.activeItems.filter(item => item !== event.item);
296
+ }
297
+ });
298
+ }
299
+ });
300
+ wrapped.onDidChangeSelection((selectedItems) => {
301
+ if (options.onDidChangeSelection) {
302
+ options.onDidChangeSelection(wrapped, selectedItems);
303
+ }
304
+ });
305
+ }
306
+ wrapped.show();
307
+ }).then(item => {
308
+ if (item === null || item === void 0 ? void 0 : item.execute) {
309
+ item.execute();
310
+ }
311
+ return item;
312
+ });
313
+ }
314
+ createQuickPick() {
315
+ const quickPick = this.monacoService.createQuickPick();
316
+ return this.wrapQuickPick(quickPick);
317
+ }
318
+ wrapQuickPick(wrapped) {
319
+ return new MonacoQuickPick(wrapped, this.keybindingRegistry);
320
+ }
321
+ convertItems(item) {
322
+ return new MonacoQuickPickItem(item, this.keybindingRegistry);
323
+ }
324
+ hide() {
325
+ return this.monacoService.hide();
326
+ }
327
+ };
328
+ __decorate([
329
+ (0, inversify_1.inject)(MonacoQuickInputImplementation),
330
+ __metadata("design:type", MonacoQuickInputImplementation)
331
+ ], MonacoQuickInputService.prototype, "monacoService", void 0);
332
+ __decorate([
333
+ (0, inversify_1.inject)(browser_1.KeybindingRegistry),
334
+ __metadata("design:type", browser_1.KeybindingRegistry)
335
+ ], MonacoQuickInputService.prototype, "keybindingRegistry", void 0);
336
+ MonacoQuickInputService = __decorate([
337
+ (0, inversify_1.injectable)()
338
+ ], MonacoQuickInputService);
339
+ exports.MonacoQuickInputService = MonacoQuickInputService;
340
+ class MonacoQuickInput {
341
+ constructor(wrapped) {
342
+ this.wrapped = wrapped;
343
+ }
344
+ get onDidHide() { return this.wrapped.onDidHide; }
345
+ get onDispose() { return this.wrapped.onDispose; }
346
+ get title() {
347
+ return this.wrapped.title;
348
+ }
349
+ set title(v) {
350
+ this.wrapped.title = v;
351
+ }
352
+ get description() {
353
+ return this.wrapped.description;
354
+ }
355
+ set description(v) {
356
+ this.wrapped.description = v;
357
+ }
358
+ get step() {
359
+ return this.wrapped.step;
360
+ }
361
+ set step(v) {
362
+ this.wrapped.step = v;
363
+ }
364
+ get enabled() {
365
+ return this.wrapped.enabled;
366
+ }
367
+ set enabled(v) {
368
+ this.wrapped.enabled = v;
369
+ }
370
+ get totalSteps() {
371
+ return this.wrapped.totalSteps;
372
+ }
373
+ set totalSteps(v) {
374
+ this.wrapped.totalSteps = v;
375
+ }
376
+ get contextKey() {
377
+ return this.wrapped.contextKey;
378
+ }
379
+ set contextKey(v) {
380
+ this.wrapped.contextKey = v;
381
+ }
382
+ get busy() {
383
+ return this.wrapped.busy;
384
+ }
385
+ set busy(v) {
386
+ this.wrapped.busy = v;
387
+ }
388
+ get ignoreFocusOut() {
389
+ return this.wrapped.ignoreFocusOut;
390
+ }
391
+ set ignoreFocusOut(v) {
392
+ this.wrapped.ignoreFocusOut = v;
393
+ }
394
+ show() {
395
+ this.wrapped.show();
396
+ }
397
+ hide() {
398
+ this.wrapped.hide();
399
+ }
400
+ dispose() {
401
+ this.wrapped.dispose();
402
+ }
403
+ }
404
+ class MonacoQuickPick extends MonacoQuickInput {
405
+ constructor(wrapped, keybindingRegistry) {
406
+ super(wrapped);
407
+ this.wrapped = wrapped;
408
+ this.keybindingRegistry = keybindingRegistry;
409
+ this.onDidAccept = this.wrapped.onDidAccept;
410
+ this.onDidChangeValue = this.wrapped.onDidChangeValue;
411
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
412
+ this.onDidTriggerButton = this.wrapped.onDidTriggerButton;
413
+ this.onDidTriggerItemButton = core_1.Event.map(this.wrapped.onDidTriggerItemButton, (evt) => ({
414
+ item: evt.item.item,
415
+ button: evt.button
416
+ }));
417
+ this.onDidChangeActive = core_1.Event.map(this.wrapped.onDidChangeActive, (items) => items.map(item => item.item));
418
+ this.onDidChangeSelection = core_1.Event.map(this.wrapped.onDidChangeSelection, (items) => items.map(item => item.item));
419
+ }
420
+ get value() {
421
+ return this.wrapped.value;
422
+ }
423
+ ;
424
+ set value(v) {
425
+ this.wrapped.value = v;
426
+ }
427
+ get placeholder() {
428
+ return this.wrapped.placeholder;
429
+ }
430
+ set placeholder(v) {
431
+ this.wrapped.placeholder = v;
432
+ }
433
+ get canSelectMany() {
434
+ return this.wrapped.canSelectMany;
435
+ }
436
+ set canSelectMany(v) {
437
+ this.wrapped.canSelectMany = v;
438
+ }
439
+ get matchOnDescription() {
440
+ return this.wrapped.matchOnDescription;
441
+ }
442
+ set matchOnDescription(v) {
443
+ this.wrapped.matchOnDescription = v;
444
+ }
445
+ get matchOnDetail() {
446
+ return this.wrapped.matchOnDetail;
447
+ }
448
+ set matchOnDetail(v) {
449
+ this.wrapped.matchOnDetail = v;
450
+ }
451
+ get keepScrollPosition() {
452
+ return this.wrapped.keepScrollPosition;
453
+ }
454
+ set keepScrollPosition(v) {
455
+ this.wrapped.keepScrollPosition = v;
456
+ }
457
+ get items() {
458
+ // need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
459
+ return this.wrapped.items.map(item => {
460
+ if (item instanceof MonacoQuickPickItem) {
461
+ return item.item;
462
+ }
463
+ else {
464
+ return item;
465
+ }
466
+ });
467
+ }
468
+ set items(itemList) {
469
+ // We need to store and apply the currently selected active items.
470
+ // Since monaco compares these items by reference equality, creating new wrapped items will unmark any active items.
471
+ // Assigning the `activeItems` again will restore all active items even after the items array has changed.
472
+ // See also the `findMonacoItemReferences` method.
473
+ const active = this.activeItems;
474
+ this.wrapped.items = itemList.map(item => browser_1.QuickPickSeparator.is(item) ? item : new MonacoQuickPickItem(item, this.keybindingRegistry));
475
+ if (active.length !== 0) {
476
+ this.activeItems = active; // If this is done with an empty activeItems array, then it will undo first item focus on quick menus.
477
+ }
478
+ }
479
+ set activeItems(itemList) {
480
+ this.wrapped.activeItems = this.findMonacoItemReferences(this.wrapped.items, itemList);
481
+ }
482
+ get activeItems() {
483
+ return this.wrapped.activeItems.map(item => item.item);
484
+ }
485
+ set selectedItems(itemList) {
486
+ this.wrapped.selectedItems = this.findMonacoItemReferences(this.wrapped.items, itemList);
487
+ }
488
+ get selectedItems() {
489
+ return this.wrapped.selectedItems.map(item => item.item);
490
+ }
491
+ /**
492
+ * Monaco doesn't check for deep equality when setting the `activeItems` or `selectedItems`.
493
+ * Instead we have to find the references of the monaco wrappers that contain the selected/active items
494
+ */
495
+ findMonacoItemReferences(source, items) {
496
+ const monacoReferences = [];
497
+ for (const item of items) {
498
+ for (const wrappedItem of source) {
499
+ if (wrappedItem instanceof MonacoQuickPickItem && wrappedItem.item === item) {
500
+ monacoReferences.push(wrappedItem);
501
+ }
502
+ }
503
+ }
504
+ return monacoReferences;
505
+ }
506
+ }
507
+ class MonacoQuickPickItem {
508
+ constructor(item, kbRegistry) {
509
+ this.item = item;
510
+ this.type = item.type;
511
+ this.id = item.id;
512
+ this.label = item.label;
513
+ this.meta = item.meta;
514
+ this.ariaLabel = item.ariaLabel;
515
+ this.description = item.description;
516
+ this.detail = item.detail;
517
+ this.keybinding = item.keySequence ? new monaco_resolved_keybinding_1.MonacoResolvedKeybinding(item.keySequence, kbRegistry) : undefined;
518
+ this.iconClasses = item.iconClasses;
519
+ this.buttons = item.buttons;
520
+ this.alwaysShow = item.alwaysShow;
521
+ this.highlights = item.highlights;
522
+ }
523
+ accept() {
524
+ if (this.item.execute) {
525
+ this.item.execute();
526
+ }
527
+ }
528
+ }
529
+ exports.MonacoQuickPickItem = MonacoQuickPickItem;
569
530
  //# sourceMappingURL=monaco-quick-input-service.js.map