@theia/output 1.45.0 → 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,249 +1,249 @@
|
|
|
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
|
-
var OutputWidget_1;
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.OutputWidget = void 0;
|
|
29
|
-
require("../../src/browser/style/output.css");
|
|
30
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
-
const algorithm_1 = require("@theia/core/shared/@phosphor/algorithm");
|
|
32
|
-
const browser_1 = require("@theia/editor/lib/browser");
|
|
33
|
-
const monaco_editor_1 = require("@theia/monaco/lib/browser/monaco-editor");
|
|
34
|
-
const selection_service_1 = require("@theia/core/lib/common/selection-service");
|
|
35
|
-
const monaco_editor_provider_1 = require("@theia/monaco/lib/browser/monaco-editor-provider");
|
|
36
|
-
const disposable_1 = require("@theia/core/lib/common/disposable");
|
|
37
|
-
const browser_2 = require("@theia/core/lib/browser");
|
|
38
|
-
const output_uri_1 = require("../common/output-uri");
|
|
39
|
-
const output_channel_1 = require("./output-channel");
|
|
40
|
-
const core_1 = require("@theia/core");
|
|
41
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
42
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
43
|
-
let OutputWidget = OutputWidget_1 = class OutputWidget extends browser_2.BaseWidget {
|
|
44
|
-
constructor() {
|
|
45
|
-
super();
|
|
46
|
-
this._state = { locked: false };
|
|
47
|
-
this.toDisposeOnSelectedChannelChanged = new disposable_1.DisposableCollection();
|
|
48
|
-
this.onStateChangedEmitter = new core_1.Emitter();
|
|
49
|
-
this.id = OutputWidget_1.ID;
|
|
50
|
-
this.title.label = OutputWidget_1.LABEL;
|
|
51
|
-
this.title.caption = OutputWidget_1.LABEL;
|
|
52
|
-
this.title.iconClass = (0, browser_2.codicon)('output');
|
|
53
|
-
this.title.closable = true;
|
|
54
|
-
this.addClass('theia-output');
|
|
55
|
-
this.node.tabIndex = 0;
|
|
56
|
-
this.editorContainer = new NoopDragOverDockPanel({ spacing: 0, mode: 'single-document' });
|
|
57
|
-
this.editorContainer.addClass('editor-container');
|
|
58
|
-
this.editorContainer.node.tabIndex = -1;
|
|
59
|
-
}
|
|
60
|
-
init() {
|
|
61
|
-
this.toDispose.pushAll([
|
|
62
|
-
this.outputChannelManager.onChannelWasHidden(() => this.refreshEditorWidget()),
|
|
63
|
-
this.outputChannelManager.onChannelWasShown(({ preserveFocus }) => this.refreshEditorWidget({ preserveFocus: !!preserveFocus })),
|
|
64
|
-
this.toDisposeOnSelectedChannelChanged,
|
|
65
|
-
this.onStateChangedEmitter,
|
|
66
|
-
this.onStateChanged(() => this.update())
|
|
67
|
-
]);
|
|
68
|
-
this.refreshEditorWidget();
|
|
69
|
-
}
|
|
70
|
-
storeState() {
|
|
71
|
-
return this.state;
|
|
72
|
-
}
|
|
73
|
-
restoreState(oldState) {
|
|
74
|
-
const copy = (0, core_1.deepClone)(this.state);
|
|
75
|
-
if (oldState.locked) {
|
|
76
|
-
copy.locked = oldState.locked;
|
|
77
|
-
}
|
|
78
|
-
this.state = copy;
|
|
79
|
-
}
|
|
80
|
-
get state() {
|
|
81
|
-
return this._state;
|
|
82
|
-
}
|
|
83
|
-
set state(state) {
|
|
84
|
-
this._state = state;
|
|
85
|
-
this.onStateChangedEmitter.fire(this._state);
|
|
86
|
-
}
|
|
87
|
-
async refreshEditorWidget({ preserveFocus } = { preserveFocus: false }) {
|
|
88
|
-
const { selectedChannel } = this;
|
|
89
|
-
const editorWidget = this.editorWidget;
|
|
90
|
-
if (selectedChannel && editorWidget) {
|
|
91
|
-
// If the input is the current one, do nothing.
|
|
92
|
-
const model = editorWidget.editor.getControl().getModel();
|
|
93
|
-
if (model && model.uri.toString() === selectedChannel.uri.toString()) {
|
|
94
|
-
if (!preserveFocus) {
|
|
95
|
-
this.activate();
|
|
96
|
-
}
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
this.toDisposeOnSelectedChannelChanged.dispose();
|
|
101
|
-
if (selectedChannel) {
|
|
102
|
-
const widget = await this.createEditorWidget();
|
|
103
|
-
if (widget) {
|
|
104
|
-
this.editorContainer.addWidget(widget);
|
|
105
|
-
this.toDisposeOnSelectedChannelChanged.pushAll([
|
|
106
|
-
disposable_1.Disposable.create(() => widget.close()),
|
|
107
|
-
selectedChannel.onContentChange(() => this.revealLastLine())
|
|
108
|
-
]);
|
|
109
|
-
if (!preserveFocus) {
|
|
110
|
-
this.activate();
|
|
111
|
-
}
|
|
112
|
-
this.revealLastLine();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
onAfterAttach(message) {
|
|
117
|
-
super.onAfterAttach(message);
|
|
118
|
-
browser_2.Widget.attach(this.editorContainer, this.node);
|
|
119
|
-
this.toDisposeOnDetach.push(disposable_1.Disposable.create(() => browser_2.Widget.detach(this.editorContainer)));
|
|
120
|
-
}
|
|
121
|
-
onActivateRequest(message) {
|
|
122
|
-
super.onActivateRequest(message);
|
|
123
|
-
if (this.editor) {
|
|
124
|
-
this.editor.focus();
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
this.node.focus();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
onResize(message) {
|
|
131
|
-
super.onResize(message);
|
|
132
|
-
browser_2.MessageLoop.sendMessage(this.editorContainer, browser_2.Widget.ResizeMessage.UnknownSize);
|
|
133
|
-
for (const widget of (0, algorithm_1.toArray)(this.editorContainer.widgets())) {
|
|
134
|
-
browser_2.MessageLoop.sendMessage(widget, browser_2.Widget.ResizeMessage.UnknownSize);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
onAfterShow(msg) {
|
|
138
|
-
super.onAfterShow(msg);
|
|
139
|
-
this.onResize(browser_2.Widget.ResizeMessage.UnknownSize); // Triggers an editor widget resize. (#8361)
|
|
140
|
-
}
|
|
141
|
-
get onStateChanged() {
|
|
142
|
-
return this.onStateChangedEmitter.event;
|
|
143
|
-
}
|
|
144
|
-
clear() {
|
|
145
|
-
if (this.selectedChannel) {
|
|
146
|
-
this.selectedChannel.clear();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
selectAll() {
|
|
150
|
-
const editor = this.editor;
|
|
151
|
-
if (editor) {
|
|
152
|
-
const model = editor.getControl().getModel();
|
|
153
|
-
if (model) {
|
|
154
|
-
const endLine = model.getLineCount();
|
|
155
|
-
const endCharacter = model.getLineMaxColumn(endLine);
|
|
156
|
-
editor.getControl().setSelection(new monaco.Range(1, 1, endLine, endCharacter));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
lock() {
|
|
161
|
-
this.state = { ...(0, core_1.deepClone)(this.state), locked: true };
|
|
162
|
-
}
|
|
163
|
-
unlock() {
|
|
164
|
-
this.state = { ...(0, core_1.deepClone)(this.state), locked: false };
|
|
165
|
-
}
|
|
166
|
-
get isLocked() {
|
|
167
|
-
return !!this.state.locked;
|
|
168
|
-
}
|
|
169
|
-
revealLastLine() {
|
|
170
|
-
if (this.isLocked) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const editor = this.editor;
|
|
174
|
-
if (editor) {
|
|
175
|
-
const model = editor.getControl().getModel();
|
|
176
|
-
if (model) {
|
|
177
|
-
const lineNumber = model.getLineCount();
|
|
178
|
-
const column = model.getLineMaxColumn(lineNumber);
|
|
179
|
-
editor.getControl().revealPosition({ lineNumber, column }, monaco.editor.ScrollType.Smooth);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
get selectedChannel() {
|
|
184
|
-
return this.outputChannelManager.selectedChannel;
|
|
185
|
-
}
|
|
186
|
-
async createEditorWidget() {
|
|
187
|
-
if (!this.selectedChannel) {
|
|
188
|
-
return undefined;
|
|
189
|
-
}
|
|
190
|
-
const { name } = this.selectedChannel;
|
|
191
|
-
const editor = await this.editorProvider.get(output_uri_1.OutputUri.create(name));
|
|
192
|
-
return new browser_1.EditorWidget(editor, this.selectionService);
|
|
193
|
-
}
|
|
194
|
-
get editorWidget() {
|
|
195
|
-
for (const widget of (0, algorithm_1.toArray)(this.editorContainer.children())) {
|
|
196
|
-
if (widget instanceof browser_1.EditorWidget) {
|
|
197
|
-
return widget;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
return undefined;
|
|
201
|
-
}
|
|
202
|
-
get editor() {
|
|
203
|
-
const widget = this.editorWidget;
|
|
204
|
-
if (widget instanceof browser_1.EditorWidget) {
|
|
205
|
-
if (widget.editor instanceof monaco_editor_1.MonacoEditor) {
|
|
206
|
-
return widget.editor;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return undefined;
|
|
210
|
-
}
|
|
211
|
-
getText() {
|
|
212
|
-
var _a, _b;
|
|
213
|
-
return (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getControl().getModel()) === null || _b === void 0 ? void 0 : _b.getValue();
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
OutputWidget.ID = 'outputView';
|
|
217
|
-
OutputWidget.LABEL = nls_1.nls.localizeByDefault('Output');
|
|
218
|
-
__decorate([
|
|
219
|
-
(0, inversify_1.inject)(selection_service_1.SelectionService),
|
|
220
|
-
__metadata("design:type", selection_service_1.SelectionService)
|
|
221
|
-
], OutputWidget.prototype, "selectionService", void 0);
|
|
222
|
-
__decorate([
|
|
223
|
-
(0, inversify_1.inject)(monaco_editor_provider_1.MonacoEditorProvider),
|
|
224
|
-
__metadata("design:type", monaco_editor_provider_1.MonacoEditorProvider)
|
|
225
|
-
], OutputWidget.prototype, "editorProvider", void 0);
|
|
226
|
-
__decorate([
|
|
227
|
-
(0, inversify_1.inject)(output_channel_1.OutputChannelManager),
|
|
228
|
-
__metadata("design:type", output_channel_1.OutputChannelManager)
|
|
229
|
-
], OutputWidget.prototype, "outputChannelManager", void 0);
|
|
230
|
-
__decorate([
|
|
231
|
-
(0, inversify_1.postConstruct)(),
|
|
232
|
-
__metadata("design:type", Function),
|
|
233
|
-
__metadata("design:paramtypes", []),
|
|
234
|
-
__metadata("design:returntype", void 0)
|
|
235
|
-
], OutputWidget.prototype, "init", null);
|
|
236
|
-
OutputWidget = OutputWidget_1 = __decorate([
|
|
237
|
-
(0, inversify_1.injectable)(),
|
|
238
|
-
__metadata("design:paramtypes", [])
|
|
239
|
-
], OutputWidget);
|
|
240
|
-
exports.OutputWidget = OutputWidget;
|
|
241
|
-
/**
|
|
242
|
-
* Customized `DockPanel` that does not allow dropping widgets into it.
|
|
243
|
-
*/
|
|
244
|
-
class NoopDragOverDockPanel extends browser_2.DockPanel {
|
|
245
|
-
}
|
|
246
|
-
NoopDragOverDockPanel.prototype['_evtDragOver'] = () => { };
|
|
247
|
-
NoopDragOverDockPanel.prototype['_evtDrop'] = () => { };
|
|
248
|
-
NoopDragOverDockPanel.prototype['_evtDragLeave'] = () => { };
|
|
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
|
+
var OutputWidget_1;
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.OutputWidget = void 0;
|
|
29
|
+
require("../../src/browser/style/output.css");
|
|
30
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
+
const algorithm_1 = require("@theia/core/shared/@phosphor/algorithm");
|
|
32
|
+
const browser_1 = require("@theia/editor/lib/browser");
|
|
33
|
+
const monaco_editor_1 = require("@theia/monaco/lib/browser/monaco-editor");
|
|
34
|
+
const selection_service_1 = require("@theia/core/lib/common/selection-service");
|
|
35
|
+
const monaco_editor_provider_1 = require("@theia/monaco/lib/browser/monaco-editor-provider");
|
|
36
|
+
const disposable_1 = require("@theia/core/lib/common/disposable");
|
|
37
|
+
const browser_2 = require("@theia/core/lib/browser");
|
|
38
|
+
const output_uri_1 = require("../common/output-uri");
|
|
39
|
+
const output_channel_1 = require("./output-channel");
|
|
40
|
+
const core_1 = require("@theia/core");
|
|
41
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
42
|
+
const monaco = require("@theia/monaco-editor-core");
|
|
43
|
+
let OutputWidget = OutputWidget_1 = class OutputWidget extends browser_2.BaseWidget {
|
|
44
|
+
constructor() {
|
|
45
|
+
super();
|
|
46
|
+
this._state = { locked: false };
|
|
47
|
+
this.toDisposeOnSelectedChannelChanged = new disposable_1.DisposableCollection();
|
|
48
|
+
this.onStateChangedEmitter = new core_1.Emitter();
|
|
49
|
+
this.id = OutputWidget_1.ID;
|
|
50
|
+
this.title.label = OutputWidget_1.LABEL;
|
|
51
|
+
this.title.caption = OutputWidget_1.LABEL;
|
|
52
|
+
this.title.iconClass = (0, browser_2.codicon)('output');
|
|
53
|
+
this.title.closable = true;
|
|
54
|
+
this.addClass('theia-output');
|
|
55
|
+
this.node.tabIndex = 0;
|
|
56
|
+
this.editorContainer = new NoopDragOverDockPanel({ spacing: 0, mode: 'single-document' });
|
|
57
|
+
this.editorContainer.addClass('editor-container');
|
|
58
|
+
this.editorContainer.node.tabIndex = -1;
|
|
59
|
+
}
|
|
60
|
+
init() {
|
|
61
|
+
this.toDispose.pushAll([
|
|
62
|
+
this.outputChannelManager.onChannelWasHidden(() => this.refreshEditorWidget()),
|
|
63
|
+
this.outputChannelManager.onChannelWasShown(({ preserveFocus }) => this.refreshEditorWidget({ preserveFocus: !!preserveFocus })),
|
|
64
|
+
this.toDisposeOnSelectedChannelChanged,
|
|
65
|
+
this.onStateChangedEmitter,
|
|
66
|
+
this.onStateChanged(() => this.update())
|
|
67
|
+
]);
|
|
68
|
+
this.refreshEditorWidget();
|
|
69
|
+
}
|
|
70
|
+
storeState() {
|
|
71
|
+
return this.state;
|
|
72
|
+
}
|
|
73
|
+
restoreState(oldState) {
|
|
74
|
+
const copy = (0, core_1.deepClone)(this.state);
|
|
75
|
+
if (oldState.locked) {
|
|
76
|
+
copy.locked = oldState.locked;
|
|
77
|
+
}
|
|
78
|
+
this.state = copy;
|
|
79
|
+
}
|
|
80
|
+
get state() {
|
|
81
|
+
return this._state;
|
|
82
|
+
}
|
|
83
|
+
set state(state) {
|
|
84
|
+
this._state = state;
|
|
85
|
+
this.onStateChangedEmitter.fire(this._state);
|
|
86
|
+
}
|
|
87
|
+
async refreshEditorWidget({ preserveFocus } = { preserveFocus: false }) {
|
|
88
|
+
const { selectedChannel } = this;
|
|
89
|
+
const editorWidget = this.editorWidget;
|
|
90
|
+
if (selectedChannel && editorWidget) {
|
|
91
|
+
// If the input is the current one, do nothing.
|
|
92
|
+
const model = editorWidget.editor.getControl().getModel();
|
|
93
|
+
if (model && model.uri.toString() === selectedChannel.uri.toString()) {
|
|
94
|
+
if (!preserveFocus) {
|
|
95
|
+
this.activate();
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
this.toDisposeOnSelectedChannelChanged.dispose();
|
|
101
|
+
if (selectedChannel) {
|
|
102
|
+
const widget = await this.createEditorWidget();
|
|
103
|
+
if (widget) {
|
|
104
|
+
this.editorContainer.addWidget(widget);
|
|
105
|
+
this.toDisposeOnSelectedChannelChanged.pushAll([
|
|
106
|
+
disposable_1.Disposable.create(() => widget.close()),
|
|
107
|
+
selectedChannel.onContentChange(() => this.revealLastLine())
|
|
108
|
+
]);
|
|
109
|
+
if (!preserveFocus) {
|
|
110
|
+
this.activate();
|
|
111
|
+
}
|
|
112
|
+
this.revealLastLine();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
onAfterAttach(message) {
|
|
117
|
+
super.onAfterAttach(message);
|
|
118
|
+
browser_2.Widget.attach(this.editorContainer, this.node);
|
|
119
|
+
this.toDisposeOnDetach.push(disposable_1.Disposable.create(() => browser_2.Widget.detach(this.editorContainer)));
|
|
120
|
+
}
|
|
121
|
+
onActivateRequest(message) {
|
|
122
|
+
super.onActivateRequest(message);
|
|
123
|
+
if (this.editor) {
|
|
124
|
+
this.editor.focus();
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.node.focus();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
onResize(message) {
|
|
131
|
+
super.onResize(message);
|
|
132
|
+
browser_2.MessageLoop.sendMessage(this.editorContainer, browser_2.Widget.ResizeMessage.UnknownSize);
|
|
133
|
+
for (const widget of (0, algorithm_1.toArray)(this.editorContainer.widgets())) {
|
|
134
|
+
browser_2.MessageLoop.sendMessage(widget, browser_2.Widget.ResizeMessage.UnknownSize);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
onAfterShow(msg) {
|
|
138
|
+
super.onAfterShow(msg);
|
|
139
|
+
this.onResize(browser_2.Widget.ResizeMessage.UnknownSize); // Triggers an editor widget resize. (#8361)
|
|
140
|
+
}
|
|
141
|
+
get onStateChanged() {
|
|
142
|
+
return this.onStateChangedEmitter.event;
|
|
143
|
+
}
|
|
144
|
+
clear() {
|
|
145
|
+
if (this.selectedChannel) {
|
|
146
|
+
this.selectedChannel.clear();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
selectAll() {
|
|
150
|
+
const editor = this.editor;
|
|
151
|
+
if (editor) {
|
|
152
|
+
const model = editor.getControl().getModel();
|
|
153
|
+
if (model) {
|
|
154
|
+
const endLine = model.getLineCount();
|
|
155
|
+
const endCharacter = model.getLineMaxColumn(endLine);
|
|
156
|
+
editor.getControl().setSelection(new monaco.Range(1, 1, endLine, endCharacter));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
lock() {
|
|
161
|
+
this.state = { ...(0, core_1.deepClone)(this.state), locked: true };
|
|
162
|
+
}
|
|
163
|
+
unlock() {
|
|
164
|
+
this.state = { ...(0, core_1.deepClone)(this.state), locked: false };
|
|
165
|
+
}
|
|
166
|
+
get isLocked() {
|
|
167
|
+
return !!this.state.locked;
|
|
168
|
+
}
|
|
169
|
+
revealLastLine() {
|
|
170
|
+
if (this.isLocked) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const editor = this.editor;
|
|
174
|
+
if (editor) {
|
|
175
|
+
const model = editor.getControl().getModel();
|
|
176
|
+
if (model) {
|
|
177
|
+
const lineNumber = model.getLineCount();
|
|
178
|
+
const column = model.getLineMaxColumn(lineNumber);
|
|
179
|
+
editor.getControl().revealPosition({ lineNumber, column }, monaco.editor.ScrollType.Smooth);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
get selectedChannel() {
|
|
184
|
+
return this.outputChannelManager.selectedChannel;
|
|
185
|
+
}
|
|
186
|
+
async createEditorWidget() {
|
|
187
|
+
if (!this.selectedChannel) {
|
|
188
|
+
return undefined;
|
|
189
|
+
}
|
|
190
|
+
const { name } = this.selectedChannel;
|
|
191
|
+
const editor = await this.editorProvider.get(output_uri_1.OutputUri.create(name));
|
|
192
|
+
return new browser_1.EditorWidget(editor, this.selectionService);
|
|
193
|
+
}
|
|
194
|
+
get editorWidget() {
|
|
195
|
+
for (const widget of (0, algorithm_1.toArray)(this.editorContainer.children())) {
|
|
196
|
+
if (widget instanceof browser_1.EditorWidget) {
|
|
197
|
+
return widget;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
get editor() {
|
|
203
|
+
const widget = this.editorWidget;
|
|
204
|
+
if (widget instanceof browser_1.EditorWidget) {
|
|
205
|
+
if (widget.editor instanceof monaco_editor_1.MonacoEditor) {
|
|
206
|
+
return widget.editor;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
getText() {
|
|
212
|
+
var _a, _b;
|
|
213
|
+
return (_b = (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getControl().getModel()) === null || _b === void 0 ? void 0 : _b.getValue();
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
OutputWidget.ID = 'outputView';
|
|
217
|
+
OutputWidget.LABEL = nls_1.nls.localizeByDefault('Output');
|
|
218
|
+
__decorate([
|
|
219
|
+
(0, inversify_1.inject)(selection_service_1.SelectionService),
|
|
220
|
+
__metadata("design:type", selection_service_1.SelectionService)
|
|
221
|
+
], OutputWidget.prototype, "selectionService", void 0);
|
|
222
|
+
__decorate([
|
|
223
|
+
(0, inversify_1.inject)(monaco_editor_provider_1.MonacoEditorProvider),
|
|
224
|
+
__metadata("design:type", monaco_editor_provider_1.MonacoEditorProvider)
|
|
225
|
+
], OutputWidget.prototype, "editorProvider", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
(0, inversify_1.inject)(output_channel_1.OutputChannelManager),
|
|
228
|
+
__metadata("design:type", output_channel_1.OutputChannelManager)
|
|
229
|
+
], OutputWidget.prototype, "outputChannelManager", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
(0, inversify_1.postConstruct)(),
|
|
232
|
+
__metadata("design:type", Function),
|
|
233
|
+
__metadata("design:paramtypes", []),
|
|
234
|
+
__metadata("design:returntype", void 0)
|
|
235
|
+
], OutputWidget.prototype, "init", null);
|
|
236
|
+
OutputWidget = OutputWidget_1 = __decorate([
|
|
237
|
+
(0, inversify_1.injectable)(),
|
|
238
|
+
__metadata("design:paramtypes", [])
|
|
239
|
+
], OutputWidget);
|
|
240
|
+
exports.OutputWidget = OutputWidget;
|
|
241
|
+
/**
|
|
242
|
+
* Customized `DockPanel` that does not allow dropping widgets into it.
|
|
243
|
+
*/
|
|
244
|
+
class NoopDragOverDockPanel extends browser_2.DockPanel {
|
|
245
|
+
}
|
|
246
|
+
NoopDragOverDockPanel.prototype['_evtDragOver'] = () => { };
|
|
247
|
+
NoopDragOverDockPanel.prototype['_evtDrop'] = () => { };
|
|
248
|
+
NoopDragOverDockPanel.prototype['_evtDragLeave'] = () => { };
|
|
249
249
|
//# sourceMappingURL=output-widget.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import URI from '@theia/core/lib/common/uri';
|
|
2
|
-
export declare namespace OutputUri {
|
|
3
|
-
const SCHEME = "output";
|
|
4
|
-
function is(uri: string | URI): boolean;
|
|
5
|
-
function create(name: string): URI;
|
|
6
|
-
function channelName(uri: string | URI): string;
|
|
7
|
-
}
|
|
1
|
+
import URI from '@theia/core/lib/common/uri';
|
|
2
|
+
export declare namespace OutputUri {
|
|
3
|
+
const SCHEME = "output";
|
|
4
|
+
function is(uri: string | URI): boolean;
|
|
5
|
+
function create(name: string): URI;
|
|
6
|
+
function channelName(uri: string | URI): string;
|
|
7
|
+
}
|
|
8
8
|
//# sourceMappingURL=output-uri.d.ts.map
|
package/lib/common/output-uri.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2020 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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.OutputUri = void 0;
|
|
19
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
20
|
-
var OutputUri;
|
|
21
|
-
(function (OutputUri) {
|
|
22
|
-
OutputUri.SCHEME = 'output';
|
|
23
|
-
function is(uri) {
|
|
24
|
-
if (uri instanceof uri_1.default) {
|
|
25
|
-
return uri.scheme === OutputUri.SCHEME;
|
|
26
|
-
}
|
|
27
|
-
return is(new uri_1.default(uri));
|
|
28
|
-
}
|
|
29
|
-
OutputUri.is = is;
|
|
30
|
-
function create(name) {
|
|
31
|
-
if (!name) {
|
|
32
|
-
throw new Error("'name' must be defined.");
|
|
33
|
-
}
|
|
34
|
-
if (!name.trim().length) {
|
|
35
|
-
throw new Error("'name' must contain at least one non-whitespace character.");
|
|
36
|
-
}
|
|
37
|
-
return new uri_1.default(encodeURIComponent(name)).withScheme(OutputUri.SCHEME);
|
|
38
|
-
}
|
|
39
|
-
OutputUri.create = create;
|
|
40
|
-
function channelName(uri) {
|
|
41
|
-
if (!is(uri)) {
|
|
42
|
-
throw new Error(`Expected '${OutputUri.SCHEME}' URI scheme. Got: ${uri} instead.`);
|
|
43
|
-
}
|
|
44
|
-
return (uri instanceof uri_1.default ? uri : new uri_1.default(uri)).toString(true).slice(`${OutputUri.SCHEME}:/`.length);
|
|
45
|
-
}
|
|
46
|
-
OutputUri.channelName = channelName;
|
|
47
|
-
})(OutputUri = exports.OutputUri || (exports.OutputUri = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2020 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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.OutputUri = void 0;
|
|
19
|
+
const uri_1 = require("@theia/core/lib/common/uri");
|
|
20
|
+
var OutputUri;
|
|
21
|
+
(function (OutputUri) {
|
|
22
|
+
OutputUri.SCHEME = 'output';
|
|
23
|
+
function is(uri) {
|
|
24
|
+
if (uri instanceof uri_1.default) {
|
|
25
|
+
return uri.scheme === OutputUri.SCHEME;
|
|
26
|
+
}
|
|
27
|
+
return is(new uri_1.default(uri));
|
|
28
|
+
}
|
|
29
|
+
OutputUri.is = is;
|
|
30
|
+
function create(name) {
|
|
31
|
+
if (!name) {
|
|
32
|
+
throw new Error("'name' must be defined.");
|
|
33
|
+
}
|
|
34
|
+
if (!name.trim().length) {
|
|
35
|
+
throw new Error("'name' must contain at least one non-whitespace character.");
|
|
36
|
+
}
|
|
37
|
+
return new uri_1.default(encodeURIComponent(name)).withScheme(OutputUri.SCHEME);
|
|
38
|
+
}
|
|
39
|
+
OutputUri.create = create;
|
|
40
|
+
function channelName(uri) {
|
|
41
|
+
if (!is(uri)) {
|
|
42
|
+
throw new Error(`Expected '${OutputUri.SCHEME}' URI scheme. Got: ${uri} instead.`);
|
|
43
|
+
}
|
|
44
|
+
return (uri instanceof uri_1.default ? uri : new uri_1.default(uri)).toString(true).slice(`${OutputUri.SCHEME}:/`.length);
|
|
45
|
+
}
|
|
46
|
+
OutputUri.channelName = channelName;
|
|
47
|
+
})(OutputUri = exports.OutputUri || (exports.OutputUri = {}));
|
|
48
48
|
//# sourceMappingURL=output-uri.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=output-uri.spec.d.ts.map
|