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