@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.
- package/README.md +100 -100
- package/data/monaco-nls.json +1379 -1379
- package/data/monaco-themes/vscode/dark_plus.json +201 -201
- package/data/monaco-themes/vscode/dark_theia.json +5 -5
- package/data/monaco-themes/vscode/dark_vs.json +393 -393
- package/data/monaco-themes/vscode/hc_black.json +457 -457
- package/data/monaco-themes/vscode/hc_light.json +590 -590
- package/data/monaco-themes/vscode/hc_theia.json +5 -5
- package/data/monaco-themes/vscode/hc_theia_light.json +5 -5
- package/data/monaco-themes/vscode/light_plus.json +202 -202
- package/data/monaco-themes/vscode/light_theia.json +10 -10
- package/data/monaco-themes/vscode/light_vs.json +421 -421
- package/lib/browser/index.d.ts +1 -1
- package/lib/browser/index.js +28 -28
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +20 -24
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts.map +1 -1
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +122 -137
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js.map +1 -1
- package/lib/browser/monaco-bulk-edit-service.d.ts +12 -14
- package/lib/browser/monaco-bulk-edit-service.d.ts.map +1 -1
- package/lib/browser/monaco-bulk-edit-service.js +66 -66
- package/lib/browser/monaco-bulk-edit-service.js.map +1 -1
- package/lib/browser/monaco-color-registry.d.ts +16 -16
- package/lib/browser/monaco-color-registry.js +82 -82
- package/lib/browser/monaco-command-registry.d.ts +19 -19
- package/lib/browser/monaco-command-registry.d.ts.map +1 -1
- package/lib/browser/monaco-command-registry.js +88 -85
- package/lib/browser/monaco-command-registry.js.map +1 -1
- package/lib/browser/monaco-command-service.d.ts +21 -26
- package/lib/browser/monaco-command-service.d.ts.map +1 -1
- package/lib/browser/monaco-command-service.js +93 -92
- package/lib/browser/monaco-command-service.js.map +1 -1
- package/lib/browser/monaco-command.d.ts +88 -94
- package/lib/browser/monaco-command.d.ts.map +1 -1
- package/lib/browser/monaco-command.js +294 -307
- package/lib/browser/monaco-command.js.map +1 -1
- package/lib/browser/monaco-context-key-service.d.ts +22 -22
- package/lib/browser/monaco-context-key-service.d.ts.map +1 -1
- package/lib/browser/monaco-context-key-service.js +146 -147
- package/lib/browser/monaco-context-key-service.js.map +1 -1
- package/lib/browser/monaco-context-menu.d.ts +17 -16
- package/lib/browser/monaco-context-menu.d.ts.map +1 -1
- package/lib/browser/monaco-context-menu.js +112 -102
- package/lib/browser/monaco-context-menu.js.map +1 -1
- package/lib/browser/monaco-diff-editor.d.ts +29 -29
- package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
- package/lib/browser/monaco-diff-editor.js +74 -74
- package/lib/browser/monaco-diff-editor.js.map +1 -1
- package/lib/browser/monaco-diff-navigator-factory.d.ts +6 -7
- package/lib/browser/monaco-diff-navigator-factory.d.ts.map +1 -1
- package/lib/browser/monaco-diff-navigator-factory.js +45 -66
- package/lib/browser/monaco-diff-navigator-factory.js.map +1 -1
- package/lib/browser/monaco-editor-model.d.ts +158 -156
- package/lib/browser/monaco-editor-model.d.ts.map +1 -1
- package/lib/browser/monaco-editor-model.js +562 -559
- package/lib/browser/monaco-editor-model.js.map +1 -1
- package/lib/browser/monaco-editor-provider.d.ts +70 -89
- package/lib/browser/monaco-editor-provider.d.ts.map +1 -1
- package/lib/browser/monaco-editor-provider.js +386 -440
- package/lib/browser/monaco-editor-provider.js.map +1 -1
- package/lib/browser/monaco-editor-service.d.ts +32 -27
- package/lib/browser/monaco-editor-service.d.ts.map +1 -1
- package/lib/browser/monaco-editor-service.js +158 -155
- package/lib/browser/monaco-editor-service.js.map +1 -1
- package/lib/browser/monaco-editor-zone-widget.d.ts +43 -43
- package/lib/browser/monaco-editor-zone-widget.js +194 -194
- package/lib/browser/monaco-editor.d.ts +154 -151
- package/lib/browser/monaco-editor.d.ts.map +1 -1
- package/lib/browser/monaco-editor.js +542 -524
- package/lib/browser/monaco-editor.js.map +1 -1
- package/lib/browser/monaco-formatting-conflicts.d.ts +13 -13
- package/lib/browser/monaco-formatting-conflicts.js +111 -111
- package/lib/browser/monaco-formatting-conflicts.js.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.d.ts +22 -28
- package/lib/browser/monaco-frontend-application-contribution.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-application-contribution.js +178 -215
- package/lib/browser/monaco-frontend-application-contribution.js.map +1 -1
- package/lib/browser/monaco-frontend-module.d.ts +7 -7
- package/lib/browser/monaco-frontend-module.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-module.js +280 -271
- package/lib/browser/monaco-frontend-module.js.map +1 -1
- package/lib/browser/monaco-gotoline-quick-access.d.ts +11 -11
- package/lib/browser/monaco-gotoline-quick-access.js +64 -64
- package/lib/browser/monaco-gotosymbol-quick-access.d.ts +16 -16
- package/lib/browser/monaco-gotosymbol-quick-access.js +70 -70
- package/lib/browser/monaco-icon-registry.d.ts +10 -11
- package/lib/browser/monaco-icon-registry.d.ts.map +1 -1
- package/lib/browser/monaco-icon-registry.js +52 -50
- package/lib/browser/monaco-icon-registry.js.map +1 -1
- package/lib/browser/monaco-indexed-db.d.ts +28 -28
- package/lib/browser/monaco-indexed-db.js +131 -131
- package/lib/browser/monaco-init.d.ts +5 -0
- package/lib/browser/monaco-init.d.ts.map +1 -0
- package/lib/browser/monaco-init.js +125 -0
- package/lib/browser/monaco-init.js.map +1 -0
- package/lib/browser/monaco-keybinding.d.ts +16 -16
- package/lib/browser/monaco-keybinding.js +134 -134
- package/lib/browser/monaco-keybinding.js.map +1 -1
- package/lib/browser/monaco-keycode-map.d.ts +2 -2
- package/lib/browser/monaco-keycode-map.js +163 -163
- package/lib/browser/monaco-keycode-map.js.map +1 -1
- package/lib/browser/monaco-languages.d.ts +35 -35
- package/lib/browser/monaco-languages.js +180 -180
- package/lib/browser/monaco-marker-collection.d.ts +18 -18
- package/lib/browser/monaco-marker-collection.js +70 -70
- package/lib/browser/monaco-menu.d.ts +20 -20
- package/lib/browser/monaco-menu.js +145 -145
- package/lib/browser/monaco-mime-service.d.ts +10 -10
- package/lib/browser/monaco-mime-service.js +78 -78
- package/lib/browser/monaco-outline-contribution.d.ts +78 -78
- package/lib/browser/monaco-outline-contribution.js +384 -384
- package/lib/browser/monaco-outline-decorator.d.ts +12 -12
- package/lib/browser/monaco-outline-decorator.js +67 -67
- package/lib/browser/monaco-quick-access-registry.d.ts +11 -11
- package/lib/browser/monaco-quick-access-registry.js +99 -99
- package/lib/browser/monaco-quick-input-service.d.ts +99 -101
- package/lib/browser/monaco-quick-input-service.d.ts.map +1 -1
- package/lib/browser/monaco-quick-input-service.js +529 -568
- package/lib/browser/monaco-quick-input-service.js.map +1 -1
- package/lib/browser/monaco-resolved-keybinding.d.ts +23 -23
- package/lib/browser/monaco-resolved-keybinding.d.ts.map +1 -1
- package/lib/browser/monaco-resolved-keybinding.js +131 -131
- package/lib/browser/monaco-resolved-keybinding.js.map +1 -1
- package/lib/browser/monaco-snippet-suggest-provider.d.ts +66 -66
- package/lib/browser/monaco-snippet-suggest-provider.js +273 -273
- package/lib/browser/monaco-status-bar-contribution.d.ts +17 -17
- package/lib/browser/monaco-status-bar-contribution.js +121 -121
- package/lib/browser/monaco-text-model-service.d.ts +51 -51
- package/lib/browser/monaco-text-model-service.js +189 -189
- package/lib/browser/monaco-text-model-service.js.map +1 -1
- package/lib/browser/monaco-theming-service.d.ts +67 -67
- package/lib/browser/monaco-theming-service.js +171 -171
- package/lib/browser/monaco-to-protocol-converter.d.ts +26 -26
- package/lib/browser/monaco-to-protocol-converter.js +61 -61
- package/lib/browser/monaco-workspace.d.ts +83 -85
- package/lib/browser/monaco-workspace.d.ts.map +1 -1
- package/lib/browser/monaco-workspace.js +384 -384
- package/lib/browser/monaco-workspace.js.map +1 -1
- package/lib/browser/protocol-to-monaco-converter.d.ts +31 -31
- package/lib/browser/protocol-to-monaco-converter.js +133 -133
- package/lib/browser/simple-monaco-editor.d.ts +45 -44
- package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
- package/lib/browser/simple-monaco-editor.js +184 -176
- package/lib/browser/simple-monaco-editor.js.map +1 -1
- package/lib/browser/textmate/index.d.ts +4 -4
- package/lib/browser/textmate/index.js +31 -31
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +11 -11
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +91 -91
- package/lib/browser/textmate/monaco-textmate-service.d.ts +30 -30
- package/lib/browser/textmate/monaco-textmate-service.js +185 -185
- package/lib/browser/textmate/monaco-textmate-service.js.map +1 -1
- package/lib/browser/textmate/monaco-theme-registry.d.ts +27 -27
- package/lib/browser/textmate/monaco-theme-registry.js +173 -173
- package/lib/browser/textmate/monaco-theme-types.d.ts +20 -20
- package/lib/browser/textmate/monaco-theme-types.js +21 -21
- package/lib/browser/textmate/textmate-contribution.d.ts +9 -9
- package/lib/browser/textmate/textmate-contribution.js +27 -27
- package/lib/browser/textmate/textmate-registry.d.ts +31 -31
- package/lib/browser/textmate/textmate-registry.js +109 -109
- package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts +26 -26
- package/lib/browser/textmate/textmate-snippet-completion-provider.js +53 -53
- package/lib/browser/textmate/textmate-tokenizer.d.ts +22 -22
- package/lib/browser/textmate/textmate-tokenizer.js +65 -65
- package/lib/browser/workspace-symbol-command.d.ts +55 -55
- package/lib/browser/workspace-symbol-command.js +215 -215
- package/lib/package.spec.js +25 -25
- package/package.json +10 -10
- package/src/browser/index.ts +17 -17
- package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +109 -117
- package/src/browser/monaco-bulk-edit-service.ts +64 -64
- package/src/browser/monaco-color-registry.ts +73 -73
- package/src/browser/monaco-command-registry.ts +85 -82
- package/src/browser/monaco-command-service.ts +90 -99
- package/src/browser/monaco-command.ts +303 -313
- package/src/browser/monaco-context-key-service.ts +144 -143
- package/src/browser/monaco-context-menu.ts +100 -90
- package/src/browser/monaco-diff-editor.ts +100 -101
- package/src/browser/monaco-diff-navigator-factory.ts +39 -61
- package/src/browser/monaco-editor-model.ts +684 -681
- package/src/browser/monaco-editor-provider.ts +409 -452
- package/src/browser/monaco-editor-service.ts +149 -144
- package/src/browser/monaco-editor-zone-widget.ts +250 -250
- package/src/browser/monaco-editor.ts +663 -644
- package/src/browser/monaco-formatting-conflicts.ts +116 -116
- package/src/browser/monaco-frontend-application-contribution.ts +165 -200
- package/src/browser/monaco-frontend-module.ts +328 -320
- package/src/browser/monaco-gotoline-quick-access.ts +47 -47
- package/src/browser/monaco-gotosymbol-quick-access.ts +53 -53
- package/src/browser/monaco-icon-registry.ts +49 -47
- package/src/browser/monaco-indexed-db.ts +130 -130
- package/src/browser/monaco-init.ts +114 -0
- package/src/browser/monaco-keybinding.ts +111 -111
- package/src/browser/monaco-keycode-map.ts +171 -171
- package/src/browser/monaco-languages.ts +177 -177
- package/src/browser/monaco-marker-collection.ts +83 -83
- package/src/browser/monaco-menu.ts +142 -142
- package/src/browser/monaco-mime-service.ts +71 -71
- package/src/browser/monaco-outline-contribution.ts +404 -404
- package/src/browser/monaco-outline-decorator.ts +66 -66
- package/src/browser/monaco-quick-access-registry.ts +112 -112
- package/src/browser/monaco-quick-input-service.ts +647 -676
- package/src/browser/monaco-resolved-keybinding.ts +162 -162
- package/src/browser/monaco-snippet-suggest-provider.ts +306 -306
- package/src/browser/monaco-status-bar-contribution.ts +110 -110
- package/src/browser/monaco-text-model-service.ts +199 -199
- package/src/browser/monaco-theming-service.ts +204 -204
- package/src/browser/monaco-to-protocol-converter.ts +71 -71
- package/src/browser/monaco-workspace.ts +412 -412
- package/src/browser/protocol-to-monaco-converter.ts +158 -158
- package/src/browser/simple-monaco-editor.ts +217 -210
- package/src/browser/style/index.css +263 -263
- package/src/browser/textmate/index.ts +20 -20
- package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +90 -90
- package/src/browser/textmate/monaco-textmate-service.ts +187 -187
- package/src/browser/textmate/monaco-theme-registry.ts +176 -176
- package/src/browser/textmate/monaco-theme-types.ts +37 -37
- package/src/browser/textmate/textmate-contribution.ts +29 -29
- package/src/browser/textmate/textmate-registry.ts +129 -129
- package/src/browser/textmate/textmate-snippet-completion-provider.ts +73 -73
- package/src/browser/textmate/textmate-tokenizer.ts +84 -84
- package/src/browser/workspace-symbol-command.ts +196 -196
- package/src/package.spec.ts +28 -28
|
@@ -1,676 +1,647 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 SAP SE or an SAP affiliate company 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
|
-
import {
|
|
18
|
-
ApplicationShell,
|
|
19
|
-
InputBox, InputOptions, KeybindingRegistry,
|
|
20
|
-
QuickInputButton, QuickInputHideReason, QuickInputService, QuickPick, QuickPickItem,
|
|
21
|
-
QuickPickItemButtonEvent, QuickPickItemHighlights, QuickPickOptions, QuickPickSeparator
|
|
22
|
-
} from '@theia/core/lib/browser';
|
|
23
|
-
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
24
|
-
import {
|
|
25
|
-
IInputBox, IInputOptions, IKeyMods, IPickOptions, IQuickInput, IQuickInputButton,
|
|
26
|
-
IQuickInputService, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, IQuickPickItemButtonEvent, IQuickPickSeparator, QuickPickInput
|
|
27
|
-
} from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickInput';
|
|
28
|
-
import { IQuickInputOptions, IQuickInputStyles
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { IContextKey } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
34
|
-
import { IListOptions, List } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/list/listWidget';
|
|
35
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
36
|
-
import { ResolvedKeybinding } from '@theia/monaco-editor-core/esm/vs/base/common/keybindings';
|
|
37
|
-
import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
|
|
38
|
-
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
39
|
-
import { IMatch } from '@theia/monaco-editor-core/esm/vs/base/common/filters';
|
|
40
|
-
import { IListRenderer, IListVirtualDelegate } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/list/list';
|
|
41
|
-
import { Event } from '@theia/core';
|
|
42
|
-
import { MonacoColorRegistry } from './monaco-color-registry';
|
|
43
|
-
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
44
|
-
import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
45
|
-
import {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
readonly
|
|
57
|
-
readonly
|
|
58
|
-
readonly
|
|
59
|
-
readonly
|
|
60
|
-
readonly
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
protected
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
protected
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
wrapped.
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
wrapped.
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
get
|
|
469
|
-
return this.wrapped.
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
set
|
|
473
|
-
this.wrapped.
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
this.wrapped.
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
readonly
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
readonly
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
readonly
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
readonly description?: string;
|
|
649
|
-
readonly detail?: string;
|
|
650
|
-
readonly keybinding?: ResolvedKeybinding;
|
|
651
|
-
readonly iconClasses?: string[];
|
|
652
|
-
buttons?: IQuickInputButton[];
|
|
653
|
-
readonly alwaysShow?: boolean;
|
|
654
|
-
readonly highlights?: QuickPickItemHighlights;
|
|
655
|
-
|
|
656
|
-
constructor(readonly item: T, kbRegistry: KeybindingRegistry) {
|
|
657
|
-
this.type = item.type;
|
|
658
|
-
this.id = item.id;
|
|
659
|
-
this.label = item.label;
|
|
660
|
-
this.meta = item.meta;
|
|
661
|
-
this.ariaLabel = item.ariaLabel;
|
|
662
|
-
this.description = item.description;
|
|
663
|
-
this.detail = item.detail;
|
|
664
|
-
this.keybinding = item.keySequence ? new MonacoResolvedKeybinding(item.keySequence, kbRegistry) : undefined;
|
|
665
|
-
this.iconClasses = item.iconClasses;
|
|
666
|
-
this.buttons = item.buttons?.map(QuickInputButton.normalize);
|
|
667
|
-
this.alwaysShow = item.alwaysShow;
|
|
668
|
-
this.highlights = item.highlights;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
accept(): void {
|
|
672
|
-
if (this.item.execute) {
|
|
673
|
-
this.item.execute();
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2021 SAP SE or an SAP affiliate company 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
|
+
import {
|
|
18
|
+
ApplicationShell,
|
|
19
|
+
InputBox, InputOptions, KeybindingRegistry, PickOptions,
|
|
20
|
+
QuickInputButton, QuickInputHideReason, QuickInputService, QuickPick, QuickPickItem,
|
|
21
|
+
QuickPickItemButtonEvent, QuickPickItemHighlights, QuickPickOptions, QuickPickSeparator
|
|
22
|
+
} from '@theia/core/lib/browser';
|
|
23
|
+
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
24
|
+
import {
|
|
25
|
+
IInputBox, IInputOptions, IKeyMods, IPickOptions, IQuickInput, IQuickInputButton,
|
|
26
|
+
IQuickInputService, IQuickNavigateConfiguration, IQuickPick, IQuickPickItem, IQuickPickItemButtonEvent, IQuickPickSeparator, IQuickWidget, QuickPickInput
|
|
27
|
+
} from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/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';
|
|
30
|
+
import { MonacoResolvedKeybinding } from './monaco-resolved-keybinding';
|
|
31
|
+
import { IQuickAccessController } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess';
|
|
32
|
+
import { QuickAccessController } from '@theia/monaco-editor-core/esm/vs/platform/quickinput/browser/quickAccess';
|
|
33
|
+
import { IContextKey, IContextKeyService } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
34
|
+
import { IListOptions, List } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/list/listWidget';
|
|
35
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
36
|
+
import { ResolvedKeybinding } from '@theia/monaco-editor-core/esm/vs/base/common/keybindings';
|
|
37
|
+
import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
|
|
38
|
+
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
39
|
+
import { IMatch } from '@theia/monaco-editor-core/esm/vs/base/common/filters';
|
|
40
|
+
import { IListRenderer, IListVirtualDelegate } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/list/list';
|
|
41
|
+
import { CancellationToken, Event } from '@theia/core';
|
|
42
|
+
import { MonacoColorRegistry } from './monaco-color-registry';
|
|
43
|
+
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
44
|
+
import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
45
|
+
import {
|
|
46
|
+
activeContrastBorder, asCssVariable, pickerGroupBorder, pickerGroupForeground, quickInputBackground, quickInputForeground, quickInputListFocusBackground,
|
|
47
|
+
quickInputListFocusForeground, quickInputListFocusIconForeground, quickInputTitleBackground, widgetBorder, widgetShadow
|
|
48
|
+
} from '@theia/monaco-editor-core/esm/vs/platform/theme/common/colorRegistry';
|
|
49
|
+
|
|
50
|
+
import {
|
|
51
|
+
defaultButtonStyles, defaultCountBadgeStyles, defaultInputBoxStyles, defaultKeybindingLabelStyles, defaultProgressBarStyles, defaultToggleStyles, getListStyles
|
|
52
|
+
} from '@theia/monaco-editor-core/esm/vs/platform/theme/browser/defaultStyles';
|
|
53
|
+
|
|
54
|
+
// Copied from @vscode/src/vs/base/parts/quickInput/browser/quickInputList.ts
|
|
55
|
+
export interface IListElement {
|
|
56
|
+
readonly index: number;
|
|
57
|
+
readonly item: IQuickPickItem;
|
|
58
|
+
readonly saneLabel: string;
|
|
59
|
+
readonly saneAriaLabel: string;
|
|
60
|
+
readonly saneDescription?: string;
|
|
61
|
+
readonly saneDetail?: string;
|
|
62
|
+
readonly labelHighlights?: IMatch[];
|
|
63
|
+
readonly descriptionHighlights?: IMatch[];
|
|
64
|
+
readonly detailHighlights?: IMatch[];
|
|
65
|
+
readonly checked: boolean;
|
|
66
|
+
readonly separator?: IQuickPickSeparator;
|
|
67
|
+
readonly fireButtonTriggered: (event: IQuickPickItemButtonEvent<IQuickPickItem>) => void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@injectable()
|
|
71
|
+
export class MonacoQuickInputImplementation implements IQuickInputService {
|
|
72
|
+
|
|
73
|
+
declare readonly _serviceBrand: undefined;
|
|
74
|
+
|
|
75
|
+
controller: QuickInputController;
|
|
76
|
+
quickAccess: IQuickAccessController;
|
|
77
|
+
|
|
78
|
+
@inject(ApplicationShell)
|
|
79
|
+
protected readonly shell: ApplicationShell;
|
|
80
|
+
|
|
81
|
+
@inject(MonacoColorRegistry)
|
|
82
|
+
protected readonly colorRegistry: MonacoColorRegistry;
|
|
83
|
+
|
|
84
|
+
@inject(ThemeService)
|
|
85
|
+
protected readonly themeService: ThemeService;
|
|
86
|
+
|
|
87
|
+
protected container: HTMLElement;
|
|
88
|
+
private quickInputList: List<unknown>;
|
|
89
|
+
|
|
90
|
+
protected inQuickOpen: IContextKey<boolean>;
|
|
91
|
+
|
|
92
|
+
get backButton(): IQuickInputButton { return this.controller.backButton; }
|
|
93
|
+
get onShow(): monaco.IEvent<void> { return this.controller.onShow; }
|
|
94
|
+
get onHide(): monaco.IEvent<void> { return this.controller.onHide; }
|
|
95
|
+
|
|
96
|
+
@postConstruct()
|
|
97
|
+
protected init(): void {
|
|
98
|
+
this.initContainer();
|
|
99
|
+
this.initController();
|
|
100
|
+
this.quickAccess = new QuickAccessController(this, StandaloneServices.get(IInstantiationService));
|
|
101
|
+
this.inQuickOpen = StandaloneServices.get(IContextKeyService).createKey<boolean>('inQuickOpen', false);
|
|
102
|
+
this.controller.onShow(() => {
|
|
103
|
+
this.container.style.top = this.shell.mainPanel.node.getBoundingClientRect().top + 'px';
|
|
104
|
+
this.inQuickOpen.set(true);
|
|
105
|
+
});
|
|
106
|
+
this.controller.onHide(() => this.inQuickOpen.set(false));
|
|
107
|
+
|
|
108
|
+
this.themeService.initialized.then(() => this.controller.applyStyles(this.computeStyles()));
|
|
109
|
+
// Hook into the theming service of Monaco to ensure that the updates are ready.
|
|
110
|
+
StandaloneServices.get(IStandaloneThemeService).onDidColorThemeChange(() => this.controller.applyStyles(this.computeStyles()));
|
|
111
|
+
window.addEventListener('resize', () => this.updateLayout());
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
setContextKey(key: string | undefined): void {
|
|
115
|
+
if (key) {
|
|
116
|
+
StandaloneServices.get(IContextKeyService).createKey<string>(key, undefined);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
createQuickWidget(): IQuickWidget {
|
|
121
|
+
return this.controller.createQuickWidget();
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
createQuickPick<T extends IQuickPickItem>(): IQuickPick<T> {
|
|
125
|
+
return this.controller.createQuickPick<T>();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
createInputBox(): IInputBox {
|
|
129
|
+
return this.controller.createInputBox();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
open(filter: string): void {
|
|
133
|
+
this.quickAccess.show(filter);
|
|
134
|
+
setTimeout(() => {
|
|
135
|
+
this.quickInputList.focusNth(0);
|
|
136
|
+
}, 300);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
input(options?: IInputOptions, token?: monaco.CancellationToken): Promise<string | undefined> {
|
|
140
|
+
return this.controller.input(options, token);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
pick<T extends IQuickPickItem, O extends IPickOptions<T>>(
|
|
144
|
+
picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: O, token?: monaco.CancellationToken
|
|
145
|
+
): Promise<(O extends { canPickMany: true; } ? T[] : T) | undefined> {
|
|
146
|
+
return this.controller.pick(picks, options, token);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
hide(): void {
|
|
150
|
+
this.controller.hide();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
focus(): void {
|
|
154
|
+
this.controller.focus();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
toggle(): void {
|
|
158
|
+
this.controller.toggle();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
applyStyles(styles: IQuickInputStyles): void {
|
|
162
|
+
this.controller.applyStyles(styles);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
layout(dimension: monaco.editor.IDimension, titleBarOffset: number): void {
|
|
166
|
+
this.controller.layout(dimension, titleBarOffset);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
navigate(next: boolean, quickNavigate?: IQuickNavigateConfiguration): void {
|
|
170
|
+
this.controller.navigate(next, quickNavigate);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
dispose(): void {
|
|
174
|
+
this.controller.dispose();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async cancel(): Promise<void> {
|
|
178
|
+
this.controller.cancel();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async back(): Promise<void> {
|
|
182
|
+
this.controller.back();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async accept(keyMods?: IKeyMods): Promise<void> {
|
|
186
|
+
this.controller.accept(keyMods);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private initContainer(): void {
|
|
190
|
+
const container = this.container = document.createElement('div');
|
|
191
|
+
container.id = 'quick-input-container';
|
|
192
|
+
document.body.appendChild(this.container);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
private initController(): void {
|
|
196
|
+
this.controller = new QuickInputController(this.getOptions(), StandaloneServices.get(IStandaloneThemeService));
|
|
197
|
+
this.updateLayout();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private updateLayout(): void {
|
|
201
|
+
// Initialize the layout using screen dimensions as monaco computes the actual sizing.
|
|
202
|
+
// https://github.com/microsoft/vscode/blob/6261075646f055b99068d3688932416f2346dd3b/src/vs/base/parts/quickinput/browser/quickInput.ts#L1799
|
|
203
|
+
this.controller.layout(this.getClientDimension(), 0);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
private getClientDimension(): monaco.editor.IDimension {
|
|
207
|
+
return { width: window.innerWidth, height: window.innerHeight };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private getOptions(): IQuickInputOptions {
|
|
211
|
+
const options: IQuickInputOptions = {
|
|
212
|
+
idPrefix: 'quickInput_',
|
|
213
|
+
container: this.container,
|
|
214
|
+
styles: this.computeStyles(),
|
|
215
|
+
ignoreFocusOut: () => false,
|
|
216
|
+
backKeybindingLabel: () => undefined,
|
|
217
|
+
setContextKey: (id?: string) => this.setContextKey(id),
|
|
218
|
+
returnFocus: () => this.container.focus(),
|
|
219
|
+
createList: <T>(
|
|
220
|
+
user: string, container: HTMLElement, delegate: IListVirtualDelegate<T>, renderers: IListRenderer<T, unknown>[], listOptions: IListOptions<T>
|
|
221
|
+
): List<T> => this.quickInputList = new List(user, container, delegate, renderers, listOptions),
|
|
222
|
+
linkOpenerDelegate: () => {
|
|
223
|
+
// @monaco-uplift: not sure what to do here
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
return options;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// @monaco-uplift
|
|
230
|
+
// Keep the styles up to date with https://github.com/microsoft/vscode/blob/7888ff3a6b104e9e2e3d0f7890ca92dd0828215f/src/vs/platform/quickinput/browser/quickInput.ts#L171.
|
|
231
|
+
private computeStyles(): IQuickInputStyles {
|
|
232
|
+
return {
|
|
233
|
+
widget: {
|
|
234
|
+
quickInputBackground: asCssVariable(quickInputBackground),
|
|
235
|
+
quickInputForeground: asCssVariable(quickInputForeground),
|
|
236
|
+
quickInputTitleBackground: asCssVariable(quickInputTitleBackground),
|
|
237
|
+
widgetBorder: asCssVariable(widgetBorder),
|
|
238
|
+
widgetShadow: asCssVariable(widgetShadow),
|
|
239
|
+
},
|
|
240
|
+
inputBox: defaultInputBoxStyles,
|
|
241
|
+
toggle: defaultToggleStyles,
|
|
242
|
+
countBadge: defaultCountBadgeStyles,
|
|
243
|
+
button: defaultButtonStyles,
|
|
244
|
+
progressBar: defaultProgressBarStyles,
|
|
245
|
+
keybindingLabel: defaultKeybindingLabelStyles,
|
|
246
|
+
list: getListStyles({
|
|
247
|
+
listBackground: quickInputBackground,
|
|
248
|
+
listFocusBackground: quickInputListFocusBackground,
|
|
249
|
+
listFocusForeground: quickInputListFocusForeground,
|
|
250
|
+
// Look like focused when inactive.
|
|
251
|
+
listInactiveFocusForeground: quickInputListFocusForeground,
|
|
252
|
+
listInactiveSelectionIconForeground: quickInputListFocusIconForeground,
|
|
253
|
+
listInactiveFocusBackground: quickInputListFocusBackground,
|
|
254
|
+
listFocusOutline: activeContrastBorder,
|
|
255
|
+
listInactiveFocusOutline: activeContrastBorder,
|
|
256
|
+
}),
|
|
257
|
+
pickerGroup: {
|
|
258
|
+
pickerGroupBorder: asCssVariable(pickerGroupBorder),
|
|
259
|
+
pickerGroupForeground: asCssVariable(pickerGroupForeground),
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
@injectable()
|
|
266
|
+
export class MonacoQuickInputService implements QuickInputService {
|
|
267
|
+
@inject(MonacoQuickInputImplementation)
|
|
268
|
+
private monacoService: MonacoQuickInputImplementation;
|
|
269
|
+
|
|
270
|
+
@inject(KeybindingRegistry)
|
|
271
|
+
protected readonly keybindingRegistry: KeybindingRegistry;
|
|
272
|
+
|
|
273
|
+
get backButton(): QuickInputButton {
|
|
274
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
275
|
+
return this.monacoService.backButton as QuickInputButton;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
get onShow(): Event<void> { return this.monacoService.onShow; }
|
|
279
|
+
get onHide(): Event<void> { return this.monacoService.onHide; }
|
|
280
|
+
|
|
281
|
+
open(filter: string): void {
|
|
282
|
+
this.monacoService.open(filter);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
createInputBox(): InputBox {
|
|
286
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
287
|
+
return this.monacoService.createInputBox() as InputBox;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
input(options?: InputOptions, token?: monaco.CancellationToken): Promise<string | undefined> {
|
|
291
|
+
let inputOptions: IInputOptions | undefined;
|
|
292
|
+
if (options) {
|
|
293
|
+
const { validateInput, ...props } = options;
|
|
294
|
+
inputOptions = { ...props };
|
|
295
|
+
if (validateInput) {
|
|
296
|
+
inputOptions.validateInput = async input => validateInput(input);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return this.monacoService.input(inputOptions, token);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async pick<T extends QuickPickItem, O extends PickOptions<T> = PickOptions<T>>(
|
|
303
|
+
picks: Promise<QuickPickInput<T>[]> | QuickPickInput<T>[], options?: O, token?: CancellationToken
|
|
304
|
+
): Promise<T[] | T | undefined> {
|
|
305
|
+
return this.monacoService.pick(picks, options, token);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
showQuickPick<T extends QuickPickItem>(items: Array<T | QuickPickSeparator>, options?: QuickPickOptions<T>): Promise<T | undefined> {
|
|
309
|
+
return new Promise<T | undefined>((resolve, reject) => {
|
|
310
|
+
const wrapped = this.createQuickPick<T>();
|
|
311
|
+
wrapped.items = items;
|
|
312
|
+
|
|
313
|
+
if (options) {
|
|
314
|
+
wrapped.canSelectMany = !!options.canSelectMany;
|
|
315
|
+
wrapped.contextKey = options.contextKey;
|
|
316
|
+
wrapped.description = options.description;
|
|
317
|
+
wrapped.enabled = options.enabled ?? true;
|
|
318
|
+
wrapped.ignoreFocusOut = !!options.ignoreFocusOut;
|
|
319
|
+
wrapped.matchOnDescription = options.matchOnDescription ?? true;
|
|
320
|
+
wrapped.matchOnDetail = options.matchOnDetail ?? true;
|
|
321
|
+
wrapped.keepScrollPosition = options.keepScrollPosition ?? false;
|
|
322
|
+
wrapped.placeholder = options.placeholder;
|
|
323
|
+
wrapped.step = options.step;
|
|
324
|
+
wrapped.title = options.title;
|
|
325
|
+
wrapped.totalSteps = options.totalSteps;
|
|
326
|
+
|
|
327
|
+
if (options.activeItem) {
|
|
328
|
+
wrapped.activeItems = [options.activeItem];
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
wrapped.onDidAccept(() => {
|
|
332
|
+
if (options?.onDidAccept) {
|
|
333
|
+
options.onDidAccept();
|
|
334
|
+
}
|
|
335
|
+
wrapped.hide();
|
|
336
|
+
resolve(wrapped.selectedItems[0]);
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
wrapped.onDidHide(() => {
|
|
340
|
+
if (options.onDidHide) {
|
|
341
|
+
options.onDidHide();
|
|
342
|
+
};
|
|
343
|
+
wrapped.dispose();
|
|
344
|
+
setTimeout(() => resolve(undefined));
|
|
345
|
+
});
|
|
346
|
+
wrapped.onDidChangeValue((filter: string) => {
|
|
347
|
+
if (options.onDidChangeValue) {
|
|
348
|
+
options.onDidChangeValue(wrapped, filter);
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
wrapped.onDidChangeActive((activeItems: Array<T>) => {
|
|
352
|
+
if (options.onDidChangeActive) {
|
|
353
|
+
options.onDidChangeActive(wrapped, activeItems);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
wrapped.onDidTriggerButton((button: IQuickInputButton) => {
|
|
357
|
+
if (options.onDidTriggerButton) {
|
|
358
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
359
|
+
options.onDidTriggerButton(button as QuickInputButton);
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
wrapped.onDidTriggerItemButton((event: QuickPickItemButtonEvent<T>) => {
|
|
363
|
+
if (options.onDidTriggerItemButton) {
|
|
364
|
+
// https://github.com/theia-ide/vscode/blob/standalone/0.23.x/src/vs/base/parts/quickinput/browser/quickInput.ts#L1387
|
|
365
|
+
options.onDidTriggerItemButton(
|
|
366
|
+
{
|
|
367
|
+
...event,
|
|
368
|
+
removeItem: () => {
|
|
369
|
+
wrapped.items = wrapped.items.filter(item => item !== event.item);
|
|
370
|
+
wrapped.activeItems = wrapped.activeItems.filter(item => item !== event.item);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
wrapped.onDidChangeSelection((selectedItems: Array<T>) => {
|
|
376
|
+
if (options.onDidChangeSelection) {
|
|
377
|
+
options.onDidChangeSelection(wrapped, selectedItems);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
wrapped.show();
|
|
382
|
+
}).then(item => {
|
|
383
|
+
if (item?.execute) {
|
|
384
|
+
item.execute();
|
|
385
|
+
}
|
|
386
|
+
return item;
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
createQuickPick<T extends QuickPickItem>(): QuickPick<T> {
|
|
391
|
+
const quickPick = this.monacoService.createQuickPick<MonacoQuickPickItem<T>>();
|
|
392
|
+
return this.wrapQuickPick(quickPick);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
wrapQuickPick<T extends QuickPickItem>(wrapped: IQuickPick<MonacoQuickPickItem<T>>): QuickPick<T> {
|
|
396
|
+
return new MonacoQuickPick(wrapped, this.keybindingRegistry);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
protected convertItems<T extends QuickPickItem>(item: T): MonacoQuickPickItem<T> {
|
|
400
|
+
return new MonacoQuickPickItem(item, this.keybindingRegistry);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
hide(): void {
|
|
404
|
+
return this.monacoService.hide();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
class MonacoQuickInput {
|
|
409
|
+
constructor(protected readonly wrapped: IQuickInput) {
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
get onDidHide(): Event<{ reason: QuickInputHideReason }> { return this.wrapped.onDidHide; }
|
|
413
|
+
get onDispose(): Event<void> { return this.wrapped.onDispose; }
|
|
414
|
+
|
|
415
|
+
get title(): string | undefined {
|
|
416
|
+
return this.wrapped.title;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
set title(v: string | undefined) {
|
|
420
|
+
this.wrapped.title = v;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
get description(): string | undefined {
|
|
424
|
+
return this.wrapped.description;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
set description(v: string | undefined) {
|
|
428
|
+
this.wrapped.description = v;
|
|
429
|
+
}
|
|
430
|
+
get step(): number | undefined {
|
|
431
|
+
return this.wrapped.step;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
set step(v: number | undefined) {
|
|
435
|
+
this.wrapped.step = v;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
get enabled(): boolean {
|
|
439
|
+
return this.wrapped.enabled;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
set enabled(v: boolean) {
|
|
443
|
+
this.wrapped.enabled = v;
|
|
444
|
+
}
|
|
445
|
+
get totalSteps(): number | undefined {
|
|
446
|
+
return this.wrapped.totalSteps;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
set totalSteps(v: number | undefined) {
|
|
450
|
+
this.wrapped.totalSteps = v;
|
|
451
|
+
}
|
|
452
|
+
get contextKey(): string | undefined {
|
|
453
|
+
return this.wrapped.contextKey;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
set contextKey(v: string | undefined) {
|
|
457
|
+
this.wrapped.contextKey = v;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
get busy(): boolean {
|
|
461
|
+
return this.wrapped.busy;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
set busy(v: boolean) {
|
|
465
|
+
this.wrapped.busy = v;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
get ignoreFocusOut(): boolean {
|
|
469
|
+
return this.wrapped.ignoreFocusOut;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
set ignoreFocusOut(v: boolean) {
|
|
473
|
+
this.wrapped.ignoreFocusOut = v;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
show(): void {
|
|
477
|
+
this.wrapped.show();
|
|
478
|
+
}
|
|
479
|
+
hide(): void {
|
|
480
|
+
this.wrapped.hide();
|
|
481
|
+
}
|
|
482
|
+
dispose(): void {
|
|
483
|
+
this.wrapped.dispose();
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
class MonacoQuickPick<T extends QuickPickItem> extends MonacoQuickInput implements QuickPick<T> {
|
|
489
|
+
constructor(protected override readonly wrapped: IQuickPick<MonacoQuickPickItem<T>>, protected readonly keybindingRegistry: KeybindingRegistry) {
|
|
490
|
+
super(wrapped);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
get value(): string {
|
|
494
|
+
return this.wrapped.value;
|
|
495
|
+
};
|
|
496
|
+
|
|
497
|
+
set value(v: string) {
|
|
498
|
+
this.wrapped.value = v;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
get placeholder(): string | undefined {
|
|
502
|
+
return this.wrapped.placeholder;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
set placeholder(v: string | undefined) {
|
|
506
|
+
this.wrapped.placeholder = v;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
get canSelectMany(): boolean {
|
|
510
|
+
return this.wrapped.canSelectMany;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
set canSelectMany(v: boolean) {
|
|
514
|
+
this.wrapped.canSelectMany = v;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
get matchOnDescription(): boolean {
|
|
518
|
+
return this.wrapped.matchOnDescription;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
set matchOnDescription(v: boolean) {
|
|
522
|
+
this.wrapped.matchOnDescription = v;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
get matchOnDetail(): boolean {
|
|
526
|
+
return this.wrapped.matchOnDetail;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
set matchOnDetail(v: boolean) {
|
|
530
|
+
this.wrapped.matchOnDetail = v;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
get keepScrollPosition(): boolean {
|
|
534
|
+
return this.wrapped.keepScrollPosition;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
set keepScrollPosition(v: boolean) {
|
|
538
|
+
this.wrapped.keepScrollPosition = v;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
get items(): readonly (T | QuickPickSeparator)[] {
|
|
542
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
543
|
+
return this.wrapped.items.map(item => {
|
|
544
|
+
if (item instanceof MonacoQuickPickItem) {
|
|
545
|
+
return item.item;
|
|
546
|
+
} else {
|
|
547
|
+
return item;
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
set items(itemList: readonly (T | QuickPickSeparator)[]) {
|
|
553
|
+
// We need to store and apply the currently selected active items.
|
|
554
|
+
// Since monaco compares these items by reference equality, creating new wrapped items will unmark any active items.
|
|
555
|
+
// Assigning the `activeItems` again will restore all active items even after the items array has changed.
|
|
556
|
+
// See also the `findMonacoItemReferences` method.
|
|
557
|
+
const active = this.activeItems;
|
|
558
|
+
this.wrapped.items = itemList.map(item => QuickPickSeparator.is(item) ? item : new MonacoQuickPickItem<T>(item, this.keybindingRegistry));
|
|
559
|
+
if (active.length !== 0) {
|
|
560
|
+
this.activeItems = active; // If this is done with an empty activeItems array, then it will undo first item focus on quick menus.
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
set activeItems(itemList: readonly T[]) {
|
|
565
|
+
this.wrapped.activeItems = this.findMonacoItemReferences(this.wrapped.items, itemList);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
get activeItems(): readonly (T)[] {
|
|
569
|
+
return this.wrapped.activeItems.map(item => item.item);
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
set selectedItems(itemList: readonly T[]) {
|
|
573
|
+
this.wrapped.selectedItems = this.findMonacoItemReferences(this.wrapped.items, itemList);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
get selectedItems(): readonly (T)[] {
|
|
577
|
+
return this.wrapped.selectedItems.map(item => item.item);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
readonly onDidAccept: Event<{ inBackground: boolean }> = this.wrapped.onDidAccept;
|
|
581
|
+
readonly onDidChangeValue: Event<string> = this.wrapped.onDidChangeValue;
|
|
582
|
+
|
|
583
|
+
// need to cast because of vscode issue https://github.com/microsoft/vscode/issues/190584
|
|
584
|
+
readonly onDidTriggerButton: Event<QuickInputButton> = this.wrapped.onDidTriggerButton as Event<QuickInputButton>;
|
|
585
|
+
readonly onDidTriggerItemButton: Event<QuickPickItemButtonEvent<T>> =
|
|
586
|
+
Event.map(this.wrapped.onDidTriggerItemButton, (evt: IQuickPickItemButtonEvent<MonacoQuickPickItem<T>>) => ({
|
|
587
|
+
item: evt.item.item,
|
|
588
|
+
button: evt.button
|
|
589
|
+
})) as Event<QuickPickItemButtonEvent<T>>;
|
|
590
|
+
readonly onDidChangeActive: Event<T[]> = Event.map(
|
|
591
|
+
this.wrapped.onDidChangeActive,
|
|
592
|
+
(items: MonacoQuickPickItem<T>[]) => items.map(item => item.item));
|
|
593
|
+
readonly onDidChangeSelection: Event<T[]> = Event.map(
|
|
594
|
+
this.wrapped.onDidChangeSelection, (items: MonacoQuickPickItem<T>[]) => items.map(item => item.item));
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Monaco doesn't check for deep equality when setting the `activeItems` or `selectedItems`.
|
|
598
|
+
* Instead we have to find the references of the monaco wrappers that contain the selected/active items
|
|
599
|
+
*/
|
|
600
|
+
protected findMonacoItemReferences(source: readonly (MonacoQuickPickItem<T> | IQuickPickSeparator)[], items: readonly QuickPickItem[]): MonacoQuickPickItem<T>[] {
|
|
601
|
+
const monacoReferences: MonacoQuickPickItem<T>[] = [];
|
|
602
|
+
for (const item of items) {
|
|
603
|
+
for (const wrappedItem of source) {
|
|
604
|
+
if (wrappedItem instanceof MonacoQuickPickItem && wrappedItem.item === item) {
|
|
605
|
+
monacoReferences.push(wrappedItem);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return monacoReferences;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
export class MonacoQuickPickItem<T extends QuickPickItem> implements IQuickPickItem {
|
|
614
|
+
readonly type?: 'item';
|
|
615
|
+
readonly id?: string;
|
|
616
|
+
readonly label: string;
|
|
617
|
+
readonly meta?: string;
|
|
618
|
+
readonly ariaLabel?: string;
|
|
619
|
+
readonly description?: string;
|
|
620
|
+
readonly detail?: string;
|
|
621
|
+
readonly keybinding?: ResolvedKeybinding;
|
|
622
|
+
readonly iconClasses?: string[];
|
|
623
|
+
buttons?: IQuickInputButton[];
|
|
624
|
+
readonly alwaysShow?: boolean;
|
|
625
|
+
readonly highlights?: QuickPickItemHighlights;
|
|
626
|
+
|
|
627
|
+
constructor(readonly item: T, kbRegistry: KeybindingRegistry) {
|
|
628
|
+
this.type = item.type;
|
|
629
|
+
this.id = item.id;
|
|
630
|
+
this.label = item.label;
|
|
631
|
+
this.meta = item.meta;
|
|
632
|
+
this.ariaLabel = item.ariaLabel;
|
|
633
|
+
this.description = item.description;
|
|
634
|
+
this.detail = item.detail;
|
|
635
|
+
this.keybinding = item.keySequence ? new MonacoResolvedKeybinding(item.keySequence, kbRegistry) : undefined;
|
|
636
|
+
this.iconClasses = item.iconClasses;
|
|
637
|
+
this.buttons = item.buttons;
|
|
638
|
+
this.alwaysShow = item.alwaysShow;
|
|
639
|
+
this.highlights = item.highlights;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
accept(): void {
|
|
643
|
+
if (this.item.execute) {
|
|
644
|
+
this.item.execute();
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|