@theia/output 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 +33 -33
- package/lib/browser/output-channel.d.ts +125 -125
- package/lib/browser/output-channel.js +334 -334
- package/lib/browser/output-commands.d.ts +17 -17
- package/lib/browser/output-commands.js +84 -84
- package/lib/browser/output-context-menu.d.ts +11 -11
- package/lib/browser/output-context-menu.js +42 -42
- package/lib/browser/output-contribution.d.ts +29 -29
- package/lib/browser/output-contribution.js +284 -284
- package/lib/browser/output-editor-factory.d.ts +12 -12
- package/lib/browser/output-editor-factory.d.ts.map +1 -1
- package/lib/browser/output-editor-factory.js +79 -84
- package/lib/browser/output-editor-factory.js.map +1 -1
- package/lib/browser/output-editor-model-factory.d.ts +15 -15
- package/lib/browser/output-editor-model-factory.js +61 -61
- package/lib/browser/output-frontend-module.d.ts +3 -3
- package/lib/browser/output-frontend-module.js +50 -50
- package/lib/browser/output-preferences.d.ts +11 -11
- package/lib/browser/output-preferences.js +46 -46
- package/lib/browser/output-resource.d.ts +18 -18
- package/lib/browser/output-resource.js +54 -54
- package/lib/browser/output-toolbar-contribution.d.ts +21 -21
- package/lib/browser/output-toolbar-contribution.js +125 -125
- package/lib/browser/output-widget.d.ts +48 -48
- package/lib/browser/output-widget.js +248 -248
- package/lib/common/output-uri.d.ts +7 -7
- package/lib/common/output-uri.js +47 -47
- package/lib/common/output-uri.spec.d.ts +1 -1
- package/lib/common/output-uri.spec.js +50 -50
- package/package.json +7 -7
- package/src/browser/output-channel.ts +366 -366
- package/src/browser/output-commands.ts +100 -100
- package/src/browser/output-context-menu.ts +34 -34
- package/src/browser/output-contribution.ts +274 -274
- package/src/browser/output-editor-factory.ts +68 -74
- package/src/browser/output-editor-model-factory.ts +54 -54
- package/src/browser/output-frontend-module.ts +53 -53
- package/src/browser/output-preferences.ts +58 -58
- package/src/browser/output-resource.ts +65 -65
- package/src/browser/output-toolbar-contribution.tsx +116 -116
- package/src/browser/output-widget.ts +256 -256
- package/src/browser/style/output.css +31 -31
- package/src/common/output-uri.spec.ts +53 -53
- package/src/common/output-uri.ts +47 -47
|
@@ -1,285 +1,285 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.OutputContribution = void 0;
|
|
28
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
-
const widget_1 = require("@theia/core/lib/browser/widgets/widget");
|
|
30
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
31
|
-
const common_1 = require("@theia/core/lib/common");
|
|
32
|
-
const view_contribution_1 = require("@theia/core/lib/browser/shell/view-contribution");
|
|
33
|
-
const output_widget_1 = require("./output-widget");
|
|
34
|
-
const output_context_menu_1 = require("./output-context-menu");
|
|
35
|
-
const output_uri_1 = require("../common/output-uri");
|
|
36
|
-
const clipboard_service_1 = require("@theia/core/lib/browser/clipboard-service");
|
|
37
|
-
const output_channel_1 = require("./output-channel");
|
|
38
|
-
const output_commands_1 = require("./output-commands");
|
|
39
|
-
const quick_pick_service_1 = require("@theia/core/lib/common/quick-pick-service");
|
|
40
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
41
|
-
let OutputContribution = class OutputContribution extends view_contribution_1.AbstractViewContribution {
|
|
42
|
-
constructor() {
|
|
43
|
-
super({
|
|
44
|
-
widgetId: output_widget_1.OutputWidget.ID,
|
|
45
|
-
widgetName: output_widget_1.OutputWidget.LABEL,
|
|
46
|
-
defaultWidgetOptions: {
|
|
47
|
-
area: 'bottom'
|
|
48
|
-
},
|
|
49
|
-
toggleCommandId: 'output:toggle',
|
|
50
|
-
toggleKeybinding: 'CtrlCmd+Shift+U'
|
|
51
|
-
});
|
|
52
|
-
this.id = `${output_widget_1.OutputWidget.ID}-opener`;
|
|
53
|
-
}
|
|
54
|
-
init() {
|
|
55
|
-
this.outputChannelManager.onChannelWasShown(({ name, preserveFocus }) => (0, browser_1.open)(this.openerService, output_uri_1.OutputUri.create(name), { activate: !preserveFocus, reveal: true }));
|
|
56
|
-
}
|
|
57
|
-
registerCommands(registry) {
|
|
58
|
-
super.registerCommands(registry);
|
|
59
|
-
registry.registerCommand(output_commands_1.OutputCommands.CLEAR__WIDGET, {
|
|
60
|
-
isEnabled: arg => {
|
|
61
|
-
if (arg instanceof widget_1.Widget) {
|
|
62
|
-
return arg instanceof output_widget_1.OutputWidget;
|
|
63
|
-
}
|
|
64
|
-
return this.shell.currentWidget instanceof output_widget_1.OutputWidget;
|
|
65
|
-
},
|
|
66
|
-
isVisible: arg => {
|
|
67
|
-
if (arg instanceof widget_1.Widget) {
|
|
68
|
-
return arg instanceof output_widget_1.OutputWidget;
|
|
69
|
-
}
|
|
70
|
-
return this.shell.currentWidget instanceof output_widget_1.OutputWidget;
|
|
71
|
-
},
|
|
72
|
-
execute: () => {
|
|
73
|
-
this.widget.then(widget => {
|
|
74
|
-
this.withWidget(widget, output => {
|
|
75
|
-
output.clear();
|
|
76
|
-
return true;
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
registry.registerCommand(output_commands_1.OutputCommands.LOCK__WIDGET, {
|
|
82
|
-
isEnabled: widget => this.withWidget(widget, output => !output.isLocked),
|
|
83
|
-
isVisible: widget => this.withWidget(widget, output => !output.isLocked),
|
|
84
|
-
execute: widget => this.withWidget(widget, output => {
|
|
85
|
-
output.lock();
|
|
86
|
-
return true;
|
|
87
|
-
})
|
|
88
|
-
});
|
|
89
|
-
registry.registerCommand(output_commands_1.OutputCommands.UNLOCK__WIDGET, {
|
|
90
|
-
isEnabled: widget => this.withWidget(widget, output => output.isLocked),
|
|
91
|
-
isVisible: widget => this.withWidget(widget, output => output.isLocked),
|
|
92
|
-
execute: widget => this.withWidget(widget, output => {
|
|
93
|
-
output.unlock();
|
|
94
|
-
return true;
|
|
95
|
-
})
|
|
96
|
-
});
|
|
97
|
-
registry.registerCommand(output_commands_1.OutputCommands.COPY_ALL, {
|
|
98
|
-
execute: () => {
|
|
99
|
-
var _a;
|
|
100
|
-
const textToCopy = (_a = this.tryGetWidget()) === null || _a === void 0 ? void 0 : _a.getText();
|
|
101
|
-
if (textToCopy) {
|
|
102
|
-
this.clipboardService.writeText(textToCopy);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
registry.registerCommand(output_commands_1.OutputCommands.APPEND, {
|
|
107
|
-
execute: ({ name, text }) => {
|
|
108
|
-
if (name && text) {
|
|
109
|
-
this.outputChannelManager.getChannel(name).append(text);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
registry.registerCommand(output_commands_1.OutputCommands.APPEND_LINE, {
|
|
114
|
-
execute: ({ name, text }) => {
|
|
115
|
-
if (name && text) {
|
|
116
|
-
this.outputChannelManager.getChannel(name).appendLine(text);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
registry.registerCommand(output_commands_1.OutputCommands.CLEAR, {
|
|
121
|
-
execute: ({ name }) => {
|
|
122
|
-
if (name) {
|
|
123
|
-
this.outputChannelManager.getChannel(name).clear();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
registry.registerCommand(output_commands_1.OutputCommands.DISPOSE, {
|
|
128
|
-
execute: ({ name }) => {
|
|
129
|
-
if (name) {
|
|
130
|
-
this.outputChannelManager.deleteChannel(name);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
registry.registerCommand(output_commands_1.OutputCommands.SHOW, {
|
|
135
|
-
execute: ({ name, options }) => {
|
|
136
|
-
if (name) {
|
|
137
|
-
const preserveFocus = options && options.preserveFocus || false;
|
|
138
|
-
this.outputChannelManager.getChannel(name).show({ preserveFocus });
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
registry.registerCommand(output_commands_1.OutputCommands.HIDE, {
|
|
143
|
-
execute: ({ name }) => {
|
|
144
|
-
if (name) {
|
|
145
|
-
this.outputChannelManager.getChannel(name).hide();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
registry.registerCommand(output_commands_1.OutputCommands.CLEAR__QUICK_PICK, {
|
|
150
|
-
execute: async () => {
|
|
151
|
-
const channel = await this.pick({
|
|
152
|
-
placeholder: output_commands_1.OutputCommands.CLEAR__QUICK_PICK.label,
|
|
153
|
-
channels: this.outputChannelManager.getChannels().slice()
|
|
154
|
-
});
|
|
155
|
-
if (channel) {
|
|
156
|
-
channel.clear();
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
|
-
isEnabled: () => !!this.outputChannelManager.getChannels().length,
|
|
160
|
-
isVisible: () => !!this.outputChannelManager.getChannels().length
|
|
161
|
-
});
|
|
162
|
-
registry.registerCommand(output_commands_1.OutputCommands.SHOW__QUICK_PICK, {
|
|
163
|
-
execute: async () => {
|
|
164
|
-
const channel = await this.pick({
|
|
165
|
-
placeholder: output_commands_1.OutputCommands.SHOW__QUICK_PICK.label,
|
|
166
|
-
channels: this.outputChannelManager.getChannels().slice()
|
|
167
|
-
});
|
|
168
|
-
if (channel) {
|
|
169
|
-
const { name } = channel;
|
|
170
|
-
registry.executeCommand(output_commands_1.OutputCommands.SHOW.id, { name, options: { preserveFocus: false } });
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
isEnabled: () => !!this.outputChannelManager.getChannels().length,
|
|
174
|
-
isVisible: () => !!this.outputChannelManager.getChannels().length
|
|
175
|
-
});
|
|
176
|
-
registry.registerCommand(output_commands_1.OutputCommands.HIDE__QUICK_PICK, {
|
|
177
|
-
execute: async () => {
|
|
178
|
-
const channel = await this.pick({
|
|
179
|
-
placeholder: output_commands_1.OutputCommands.HIDE__QUICK_PICK.label,
|
|
180
|
-
channels: this.outputChannelManager.getVisibleChannels().slice()
|
|
181
|
-
});
|
|
182
|
-
if (channel) {
|
|
183
|
-
const { name } = channel;
|
|
184
|
-
registry.executeCommand(output_commands_1.OutputCommands.HIDE.id, { name });
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
isEnabled: () => !!this.outputChannelManager.getVisibleChannels().length,
|
|
188
|
-
isVisible: () => !!this.outputChannelManager.getVisibleChannels().length
|
|
189
|
-
});
|
|
190
|
-
registry.registerCommand(output_commands_1.OutputCommands.DISPOSE__QUICK_PICK, {
|
|
191
|
-
execute: async () => {
|
|
192
|
-
const channel = await this.pick({
|
|
193
|
-
placeholder: output_commands_1.OutputCommands.DISPOSE__QUICK_PICK.label,
|
|
194
|
-
channels: this.outputChannelManager.getChannels().slice()
|
|
195
|
-
});
|
|
196
|
-
if (channel) {
|
|
197
|
-
const { name } = channel;
|
|
198
|
-
registry.executeCommand(output_commands_1.OutputCommands.DISPOSE.id, { name });
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
isEnabled: () => !!this.outputChannelManager.getChannels().length,
|
|
202
|
-
isVisible: () => !!this.outputChannelManager.getChannels().length
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
registerMenus(registry) {
|
|
206
|
-
super.registerMenus(registry);
|
|
207
|
-
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.TEXT_EDIT_GROUP, {
|
|
208
|
-
commandId: browser_1.CommonCommands.COPY.id
|
|
209
|
-
});
|
|
210
|
-
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.TEXT_EDIT_GROUP, {
|
|
211
|
-
commandId: output_commands_1.OutputCommands.COPY_ALL.id,
|
|
212
|
-
label: nls_1.nls.localizeByDefault('Copy All')
|
|
213
|
-
});
|
|
214
|
-
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.COMMAND_GROUP, {
|
|
215
|
-
commandId: browser_1.quickCommand.id,
|
|
216
|
-
label: nls_1.nls.localizeByDefault('Command Palette...')
|
|
217
|
-
});
|
|
218
|
-
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.WIDGET_GROUP, {
|
|
219
|
-
commandId: output_commands_1.OutputCommands.CLEAR__WIDGET.id,
|
|
220
|
-
label: nls_1.nls.localizeByDefault('Clear Output')
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
canHandle(uri) {
|
|
224
|
-
return output_uri_1.OutputUri.is(uri) ? 200 : 0;
|
|
225
|
-
}
|
|
226
|
-
async open(uri, options) {
|
|
227
|
-
if (!output_uri_1.OutputUri.is(uri)) {
|
|
228
|
-
throw new Error(`Expected '${output_uri_1.OutputUri.SCHEME}' URI scheme. Got: ${uri} instead.`);
|
|
229
|
-
}
|
|
230
|
-
const widget = await this.openView(options);
|
|
231
|
-
return widget;
|
|
232
|
-
}
|
|
233
|
-
withWidget(widget = this.tryGetWidget(), predicate = () => true) {
|
|
234
|
-
return widget instanceof output_widget_1.OutputWidget ? predicate(widget) : false;
|
|
235
|
-
}
|
|
236
|
-
async pick({ channels, placeholder }) {
|
|
237
|
-
const items = [];
|
|
238
|
-
const outputChannels = nls_1.nls.localize('theia/output/outputChannels', 'Output Channels');
|
|
239
|
-
const hiddenChannels = nls_1.nls.localize('theia/output/hiddenChannels', 'Hidden Channels');
|
|
240
|
-
for (let i = 0; i < channels.length; i++) {
|
|
241
|
-
const channel = channels[i];
|
|
242
|
-
if (i === 0) {
|
|
243
|
-
items.push({ label: channel.isVisible ? outputChannels : hiddenChannels, type: 'separator' });
|
|
244
|
-
}
|
|
245
|
-
else if (!channel.isVisible && channels[i - 1].isVisible) {
|
|
246
|
-
items.push({ label: hiddenChannels, type: 'separator' });
|
|
247
|
-
}
|
|
248
|
-
items.push({ label: channel.name, value: channel });
|
|
249
|
-
}
|
|
250
|
-
const selectedItem = await this.quickPickService.show(items, { placeholder });
|
|
251
|
-
return selectedItem && ('value' in selectedItem) ? selectedItem.value : undefined;
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
__decorate([
|
|
255
|
-
(0, inversify_1.inject)(clipboard_service_1.ClipboardService),
|
|
256
|
-
__metadata("design:type", Object)
|
|
257
|
-
], OutputContribution.prototype, "clipboardService", void 0);
|
|
258
|
-
__decorate([
|
|
259
|
-
(0, inversify_1.inject)(common_1.CommandService),
|
|
260
|
-
__metadata("design:type", Object)
|
|
261
|
-
], OutputContribution.prototype, "commandService", void 0);
|
|
262
|
-
__decorate([
|
|
263
|
-
(0, inversify_1.inject)(output_channel_1.OutputChannelManager),
|
|
264
|
-
__metadata("design:type", output_channel_1.OutputChannelManager)
|
|
265
|
-
], OutputContribution.prototype, "outputChannelManager", void 0);
|
|
266
|
-
__decorate([
|
|
267
|
-
(0, inversify_1.inject)(browser_1.OpenerService),
|
|
268
|
-
__metadata("design:type", Object)
|
|
269
|
-
], OutputContribution.prototype, "openerService", void 0);
|
|
270
|
-
__decorate([
|
|
271
|
-
(0, inversify_1.inject)(quick_pick_service_1.QuickPickService),
|
|
272
|
-
__metadata("design:type", Object)
|
|
273
|
-
], OutputContribution.prototype, "quickPickService", void 0);
|
|
274
|
-
__decorate([
|
|
275
|
-
(0, inversify_1.postConstruct)(),
|
|
276
|
-
__metadata("design:type", Function),
|
|
277
|
-
__metadata("design:paramtypes", []),
|
|
278
|
-
__metadata("design:returntype", void 0)
|
|
279
|
-
], OutputContribution.prototype, "init", null);
|
|
280
|
-
OutputContribution = __decorate([
|
|
281
|
-
(0, inversify_1.injectable)(),
|
|
282
|
-
__metadata("design:paramtypes", [])
|
|
283
|
-
], OutputContribution);
|
|
284
|
-
exports.OutputContribution = OutputContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.OutputContribution = void 0;
|
|
28
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
+
const widget_1 = require("@theia/core/lib/browser/widgets/widget");
|
|
30
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
31
|
+
const common_1 = require("@theia/core/lib/common");
|
|
32
|
+
const view_contribution_1 = require("@theia/core/lib/browser/shell/view-contribution");
|
|
33
|
+
const output_widget_1 = require("./output-widget");
|
|
34
|
+
const output_context_menu_1 = require("./output-context-menu");
|
|
35
|
+
const output_uri_1 = require("../common/output-uri");
|
|
36
|
+
const clipboard_service_1 = require("@theia/core/lib/browser/clipboard-service");
|
|
37
|
+
const output_channel_1 = require("./output-channel");
|
|
38
|
+
const output_commands_1 = require("./output-commands");
|
|
39
|
+
const quick_pick_service_1 = require("@theia/core/lib/common/quick-pick-service");
|
|
40
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
41
|
+
let OutputContribution = class OutputContribution extends view_contribution_1.AbstractViewContribution {
|
|
42
|
+
constructor() {
|
|
43
|
+
super({
|
|
44
|
+
widgetId: output_widget_1.OutputWidget.ID,
|
|
45
|
+
widgetName: output_widget_1.OutputWidget.LABEL,
|
|
46
|
+
defaultWidgetOptions: {
|
|
47
|
+
area: 'bottom'
|
|
48
|
+
},
|
|
49
|
+
toggleCommandId: 'output:toggle',
|
|
50
|
+
toggleKeybinding: 'CtrlCmd+Shift+U'
|
|
51
|
+
});
|
|
52
|
+
this.id = `${output_widget_1.OutputWidget.ID}-opener`;
|
|
53
|
+
}
|
|
54
|
+
init() {
|
|
55
|
+
this.outputChannelManager.onChannelWasShown(({ name, preserveFocus }) => (0, browser_1.open)(this.openerService, output_uri_1.OutputUri.create(name), { activate: !preserveFocus, reveal: true }));
|
|
56
|
+
}
|
|
57
|
+
registerCommands(registry) {
|
|
58
|
+
super.registerCommands(registry);
|
|
59
|
+
registry.registerCommand(output_commands_1.OutputCommands.CLEAR__WIDGET, {
|
|
60
|
+
isEnabled: arg => {
|
|
61
|
+
if (arg instanceof widget_1.Widget) {
|
|
62
|
+
return arg instanceof output_widget_1.OutputWidget;
|
|
63
|
+
}
|
|
64
|
+
return this.shell.currentWidget instanceof output_widget_1.OutputWidget;
|
|
65
|
+
},
|
|
66
|
+
isVisible: arg => {
|
|
67
|
+
if (arg instanceof widget_1.Widget) {
|
|
68
|
+
return arg instanceof output_widget_1.OutputWidget;
|
|
69
|
+
}
|
|
70
|
+
return this.shell.currentWidget instanceof output_widget_1.OutputWidget;
|
|
71
|
+
},
|
|
72
|
+
execute: () => {
|
|
73
|
+
this.widget.then(widget => {
|
|
74
|
+
this.withWidget(widget, output => {
|
|
75
|
+
output.clear();
|
|
76
|
+
return true;
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
registry.registerCommand(output_commands_1.OutputCommands.LOCK__WIDGET, {
|
|
82
|
+
isEnabled: widget => this.withWidget(widget, output => !output.isLocked),
|
|
83
|
+
isVisible: widget => this.withWidget(widget, output => !output.isLocked),
|
|
84
|
+
execute: widget => this.withWidget(widget, output => {
|
|
85
|
+
output.lock();
|
|
86
|
+
return true;
|
|
87
|
+
})
|
|
88
|
+
});
|
|
89
|
+
registry.registerCommand(output_commands_1.OutputCommands.UNLOCK__WIDGET, {
|
|
90
|
+
isEnabled: widget => this.withWidget(widget, output => output.isLocked),
|
|
91
|
+
isVisible: widget => this.withWidget(widget, output => output.isLocked),
|
|
92
|
+
execute: widget => this.withWidget(widget, output => {
|
|
93
|
+
output.unlock();
|
|
94
|
+
return true;
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
registry.registerCommand(output_commands_1.OutputCommands.COPY_ALL, {
|
|
98
|
+
execute: () => {
|
|
99
|
+
var _a;
|
|
100
|
+
const textToCopy = (_a = this.tryGetWidget()) === null || _a === void 0 ? void 0 : _a.getText();
|
|
101
|
+
if (textToCopy) {
|
|
102
|
+
this.clipboardService.writeText(textToCopy);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
registry.registerCommand(output_commands_1.OutputCommands.APPEND, {
|
|
107
|
+
execute: ({ name, text }) => {
|
|
108
|
+
if (name && text) {
|
|
109
|
+
this.outputChannelManager.getChannel(name).append(text);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
registry.registerCommand(output_commands_1.OutputCommands.APPEND_LINE, {
|
|
114
|
+
execute: ({ name, text }) => {
|
|
115
|
+
if (name && text) {
|
|
116
|
+
this.outputChannelManager.getChannel(name).appendLine(text);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
registry.registerCommand(output_commands_1.OutputCommands.CLEAR, {
|
|
121
|
+
execute: ({ name }) => {
|
|
122
|
+
if (name) {
|
|
123
|
+
this.outputChannelManager.getChannel(name).clear();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
registry.registerCommand(output_commands_1.OutputCommands.DISPOSE, {
|
|
128
|
+
execute: ({ name }) => {
|
|
129
|
+
if (name) {
|
|
130
|
+
this.outputChannelManager.deleteChannel(name);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
registry.registerCommand(output_commands_1.OutputCommands.SHOW, {
|
|
135
|
+
execute: ({ name, options }) => {
|
|
136
|
+
if (name) {
|
|
137
|
+
const preserveFocus = options && options.preserveFocus || false;
|
|
138
|
+
this.outputChannelManager.getChannel(name).show({ preserveFocus });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
registry.registerCommand(output_commands_1.OutputCommands.HIDE, {
|
|
143
|
+
execute: ({ name }) => {
|
|
144
|
+
if (name) {
|
|
145
|
+
this.outputChannelManager.getChannel(name).hide();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
registry.registerCommand(output_commands_1.OutputCommands.CLEAR__QUICK_PICK, {
|
|
150
|
+
execute: async () => {
|
|
151
|
+
const channel = await this.pick({
|
|
152
|
+
placeholder: output_commands_1.OutputCommands.CLEAR__QUICK_PICK.label,
|
|
153
|
+
channels: this.outputChannelManager.getChannels().slice()
|
|
154
|
+
});
|
|
155
|
+
if (channel) {
|
|
156
|
+
channel.clear();
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
isEnabled: () => !!this.outputChannelManager.getChannels().length,
|
|
160
|
+
isVisible: () => !!this.outputChannelManager.getChannels().length
|
|
161
|
+
});
|
|
162
|
+
registry.registerCommand(output_commands_1.OutputCommands.SHOW__QUICK_PICK, {
|
|
163
|
+
execute: async () => {
|
|
164
|
+
const channel = await this.pick({
|
|
165
|
+
placeholder: output_commands_1.OutputCommands.SHOW__QUICK_PICK.label,
|
|
166
|
+
channels: this.outputChannelManager.getChannels().slice()
|
|
167
|
+
});
|
|
168
|
+
if (channel) {
|
|
169
|
+
const { name } = channel;
|
|
170
|
+
registry.executeCommand(output_commands_1.OutputCommands.SHOW.id, { name, options: { preserveFocus: false } });
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
isEnabled: () => !!this.outputChannelManager.getChannels().length,
|
|
174
|
+
isVisible: () => !!this.outputChannelManager.getChannels().length
|
|
175
|
+
});
|
|
176
|
+
registry.registerCommand(output_commands_1.OutputCommands.HIDE__QUICK_PICK, {
|
|
177
|
+
execute: async () => {
|
|
178
|
+
const channel = await this.pick({
|
|
179
|
+
placeholder: output_commands_1.OutputCommands.HIDE__QUICK_PICK.label,
|
|
180
|
+
channels: this.outputChannelManager.getVisibleChannels().slice()
|
|
181
|
+
});
|
|
182
|
+
if (channel) {
|
|
183
|
+
const { name } = channel;
|
|
184
|
+
registry.executeCommand(output_commands_1.OutputCommands.HIDE.id, { name });
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
isEnabled: () => !!this.outputChannelManager.getVisibleChannels().length,
|
|
188
|
+
isVisible: () => !!this.outputChannelManager.getVisibleChannels().length
|
|
189
|
+
});
|
|
190
|
+
registry.registerCommand(output_commands_1.OutputCommands.DISPOSE__QUICK_PICK, {
|
|
191
|
+
execute: async () => {
|
|
192
|
+
const channel = await this.pick({
|
|
193
|
+
placeholder: output_commands_1.OutputCommands.DISPOSE__QUICK_PICK.label,
|
|
194
|
+
channels: this.outputChannelManager.getChannels().slice()
|
|
195
|
+
});
|
|
196
|
+
if (channel) {
|
|
197
|
+
const { name } = channel;
|
|
198
|
+
registry.executeCommand(output_commands_1.OutputCommands.DISPOSE.id, { name });
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
isEnabled: () => !!this.outputChannelManager.getChannels().length,
|
|
202
|
+
isVisible: () => !!this.outputChannelManager.getChannels().length
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
registerMenus(registry) {
|
|
206
|
+
super.registerMenus(registry);
|
|
207
|
+
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.TEXT_EDIT_GROUP, {
|
|
208
|
+
commandId: browser_1.CommonCommands.COPY.id
|
|
209
|
+
});
|
|
210
|
+
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.TEXT_EDIT_GROUP, {
|
|
211
|
+
commandId: output_commands_1.OutputCommands.COPY_ALL.id,
|
|
212
|
+
label: nls_1.nls.localizeByDefault('Copy All')
|
|
213
|
+
});
|
|
214
|
+
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.COMMAND_GROUP, {
|
|
215
|
+
commandId: browser_1.quickCommand.id,
|
|
216
|
+
label: nls_1.nls.localizeByDefault('Command Palette...')
|
|
217
|
+
});
|
|
218
|
+
registry.registerMenuAction(output_context_menu_1.OutputContextMenu.WIDGET_GROUP, {
|
|
219
|
+
commandId: output_commands_1.OutputCommands.CLEAR__WIDGET.id,
|
|
220
|
+
label: nls_1.nls.localizeByDefault('Clear Output')
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
canHandle(uri) {
|
|
224
|
+
return output_uri_1.OutputUri.is(uri) ? 200 : 0;
|
|
225
|
+
}
|
|
226
|
+
async open(uri, options) {
|
|
227
|
+
if (!output_uri_1.OutputUri.is(uri)) {
|
|
228
|
+
throw new Error(`Expected '${output_uri_1.OutputUri.SCHEME}' URI scheme. Got: ${uri} instead.`);
|
|
229
|
+
}
|
|
230
|
+
const widget = await this.openView(options);
|
|
231
|
+
return widget;
|
|
232
|
+
}
|
|
233
|
+
withWidget(widget = this.tryGetWidget(), predicate = () => true) {
|
|
234
|
+
return widget instanceof output_widget_1.OutputWidget ? predicate(widget) : false;
|
|
235
|
+
}
|
|
236
|
+
async pick({ channels, placeholder }) {
|
|
237
|
+
const items = [];
|
|
238
|
+
const outputChannels = nls_1.nls.localize('theia/output/outputChannels', 'Output Channels');
|
|
239
|
+
const hiddenChannels = nls_1.nls.localize('theia/output/hiddenChannels', 'Hidden Channels');
|
|
240
|
+
for (let i = 0; i < channels.length; i++) {
|
|
241
|
+
const channel = channels[i];
|
|
242
|
+
if (i === 0) {
|
|
243
|
+
items.push({ label: channel.isVisible ? outputChannels : hiddenChannels, type: 'separator' });
|
|
244
|
+
}
|
|
245
|
+
else if (!channel.isVisible && channels[i - 1].isVisible) {
|
|
246
|
+
items.push({ label: hiddenChannels, type: 'separator' });
|
|
247
|
+
}
|
|
248
|
+
items.push({ label: channel.name, value: channel });
|
|
249
|
+
}
|
|
250
|
+
const selectedItem = await this.quickPickService.show(items, { placeholder });
|
|
251
|
+
return selectedItem && ('value' in selectedItem) ? selectedItem.value : undefined;
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
__decorate([
|
|
255
|
+
(0, inversify_1.inject)(clipboard_service_1.ClipboardService),
|
|
256
|
+
__metadata("design:type", Object)
|
|
257
|
+
], OutputContribution.prototype, "clipboardService", void 0);
|
|
258
|
+
__decorate([
|
|
259
|
+
(0, inversify_1.inject)(common_1.CommandService),
|
|
260
|
+
__metadata("design:type", Object)
|
|
261
|
+
], OutputContribution.prototype, "commandService", void 0);
|
|
262
|
+
__decorate([
|
|
263
|
+
(0, inversify_1.inject)(output_channel_1.OutputChannelManager),
|
|
264
|
+
__metadata("design:type", output_channel_1.OutputChannelManager)
|
|
265
|
+
], OutputContribution.prototype, "outputChannelManager", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
(0, inversify_1.inject)(browser_1.OpenerService),
|
|
268
|
+
__metadata("design:type", Object)
|
|
269
|
+
], OutputContribution.prototype, "openerService", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
(0, inversify_1.inject)(quick_pick_service_1.QuickPickService),
|
|
272
|
+
__metadata("design:type", Object)
|
|
273
|
+
], OutputContribution.prototype, "quickPickService", void 0);
|
|
274
|
+
__decorate([
|
|
275
|
+
(0, inversify_1.postConstruct)(),
|
|
276
|
+
__metadata("design:type", Function),
|
|
277
|
+
__metadata("design:paramtypes", []),
|
|
278
|
+
__metadata("design:returntype", void 0)
|
|
279
|
+
], OutputContribution.prototype, "init", null);
|
|
280
|
+
OutputContribution = __decorate([
|
|
281
|
+
(0, inversify_1.injectable)(),
|
|
282
|
+
__metadata("design:paramtypes", [])
|
|
283
|
+
], OutputContribution);
|
|
284
|
+
exports.OutputContribution = OutputContribution;
|
|
285
285
|
//# sourceMappingURL=output-contribution.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
|
|
2
|
-
import { MonacoEditorFactory } from '@theia/monaco/lib/browser/monaco-editor-provider';
|
|
3
|
-
import { MonacoContextMenuService } from '@theia/monaco/lib/browser/monaco-context-menu';
|
|
4
|
-
import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from '@theia/monaco/lib/browser/monaco-editor';
|
|
5
|
-
export declare class OutputEditorFactory implements MonacoEditorFactory {
|
|
6
|
-
protected readonly services: MonacoEditorServices;
|
|
7
|
-
protected readonly contextMenuService: MonacoContextMenuService;
|
|
8
|
-
readonly scheme: string;
|
|
9
|
-
create(model: MonacoEditorModel, defaultsOptions: MonacoEditor.IOptions
|
|
10
|
-
protected createOptions(model: MonacoEditorModel, defaultOptions: MonacoEditor.IOptions): MonacoEditor.IOptions;
|
|
11
|
-
protected createOverrides(model: MonacoEditorModel
|
|
12
|
-
}
|
|
1
|
+
import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
|
|
2
|
+
import { MonacoEditorFactory } from '@theia/monaco/lib/browser/monaco-editor-provider';
|
|
3
|
+
import { MonacoContextMenuService } from '@theia/monaco/lib/browser/monaco-context-menu';
|
|
4
|
+
import { EditorServiceOverrides, MonacoEditor, MonacoEditorServices } from '@theia/monaco/lib/browser/monaco-editor';
|
|
5
|
+
export declare class OutputEditorFactory implements MonacoEditorFactory {
|
|
6
|
+
protected readonly services: MonacoEditorServices;
|
|
7
|
+
protected readonly contextMenuService: MonacoContextMenuService;
|
|
8
|
+
readonly scheme: string;
|
|
9
|
+
create(model: MonacoEditorModel, defaultsOptions: MonacoEditor.IOptions): MonacoEditor;
|
|
10
|
+
protected createOptions(model: MonacoEditorModel, defaultOptions: MonacoEditor.IOptions): MonacoEditor.IOptions;
|
|
11
|
+
protected createOverrides(model: MonacoEditorModel): EditorServiceOverrides;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=output-editor-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output-editor-factory.d.ts","sourceRoot":"","sources":["../../src/browser/output-editor-factory.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAKrH,qBACa,mBAAoB,YAAW,mBAAmB;IAG3D,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;IAEhE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAoB;IAE3C,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"output-editor-factory.d.ts","sourceRoot":"","sources":["../../src/browser/output-editor-factory.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AACzF,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAKrH,qBACa,mBAAoB,YAAW,mBAAmB;IAG3D,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IAGlD,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;IAEhE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAoB;IAE3C,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,YAAY,CAAC,QAAQ,GAAG,YAAY;IAOtF,SAAS,CAAC,aAAa,CAAC,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,YAAY,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ;IAoB/G,SAAS,CAAE,eAAe,CAAC,KAAK,EAAE,iBAAiB,GAAG,sBAAsB;CAG/E"}
|