@theia/console 1.34.2 → 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 +30 -30
- package/lib/browser/ansi-console-item.d.ts +12 -12
- package/lib/browser/ansi-console-item.js +38 -38
- package/lib/browser/console-content-widget.d.ts +17 -17
- package/lib/browser/console-content-widget.js +90 -90
- package/lib/browser/console-contribution.d.ts +33 -33
- package/lib/browser/console-contribution.js +144 -144
- package/lib/browser/console-frontend-module.d.ts +4 -4
- package/lib/browser/console-frontend-module.js +36 -36
- package/lib/browser/console-history.d.ts +19 -19
- package/lib/browser/console-history.js +74 -74
- package/lib/browser/console-keybinding-contexts.d.ts +39 -39
- package/lib/browser/console-keybinding-contexts.js +118 -118
- package/lib/browser/console-manager.d.ts +7 -7
- package/lib/browser/console-manager.js +48 -48
- package/lib/browser/console-session-manager.d.ts +31 -31
- package/lib/browser/console-session-manager.js +116 -116
- package/lib/browser/console-session.d.ts +27 -27
- package/lib/browser/console-session.js +56 -56
- package/lib/browser/console-widget.d.ts +62 -62
- package/lib/browser/console-widget.js +247 -247
- package/lib/package.spec.js +25 -25
- package/package.json +5 -5
- package/src/browser/ansi-console-item.tsx +48 -48
- package/src/browser/console-content-widget.tsx +91 -91
- package/src/browser/console-contribution.ts +144 -144
- package/src/browser/console-frontend-module.ts +37 -37
- package/src/browser/console-history.ts +76 -76
- package/src/browser/console-keybinding-contexts.ts +107 -107
- package/src/browser/console-manager.ts +37 -37
- package/src/browser/console-session-manager.ts +121 -121
- package/src/browser/console-session.ts +61 -61
- package/src/browser/console-widget.ts +273 -273
- package/src/browser/style/index.css +49 -49
- package/src/package.spec.ts +28 -28
|
@@ -1,248 +1,248 @@
|
|
|
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 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 ConsoleWidget_1;
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.ConsoleWidget = exports.ConsoleOptions = void 0;
|
|
29
|
-
const domutils_1 = require("@theia/core/shared/@phosphor/domutils");
|
|
30
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
-
const source_tree_1 = require("@theia/core/lib/browser/source-tree");
|
|
32
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
33
|
-
const monaco_editor_provider_1 = require("@theia/monaco/lib/browser/monaco-editor-provider");
|
|
34
|
-
const console_history_1 = require("./console-history");
|
|
35
|
-
const console_content_widget_1 = require("./console-content-widget");
|
|
36
|
-
const console_session_manager_1 = require("./console-session-manager");
|
|
37
|
-
const monaco = require("@theia/monaco-editor-core");
|
|
38
|
-
exports.ConsoleOptions = Symbol('ConsoleWidgetOptions');
|
|
39
|
-
let ConsoleWidget = ConsoleWidget_1 = class ConsoleWidget extends browser_1.BaseWidget {
|
|
40
|
-
constructor() {
|
|
41
|
-
super();
|
|
42
|
-
this.totalHeight = -1;
|
|
43
|
-
this.totalWidth = -1;
|
|
44
|
-
this.node.classList.add(ConsoleWidget_1.styles.node);
|
|
45
|
-
}
|
|
46
|
-
static createContainer(parent, options) {
|
|
47
|
-
const child = console_content_widget_1.ConsoleContentWidget.createContainer(parent);
|
|
48
|
-
child.bind(console_history_1.ConsoleHistory).toSelf();
|
|
49
|
-
child.bind(exports.ConsoleOptions).toConstantValue(options);
|
|
50
|
-
child.bind(ConsoleWidget_1).toSelf();
|
|
51
|
-
return child;
|
|
52
|
-
}
|
|
53
|
-
async init() {
|
|
54
|
-
const { id, title, inputFocusContextKey } = this.options;
|
|
55
|
-
const { label, iconClass, caption } = Object.assign({}, title);
|
|
56
|
-
this.id = id;
|
|
57
|
-
this.title.closable = true;
|
|
58
|
-
this.title.label = label || id;
|
|
59
|
-
if (iconClass) {
|
|
60
|
-
this.title.iconClass = iconClass;
|
|
61
|
-
}
|
|
62
|
-
this.title.caption = caption || label || id;
|
|
63
|
-
const layout = this.layout = new browser_1.PanelLayout();
|
|
64
|
-
this.content.node.classList.add(ConsoleWidget_1.styles.content);
|
|
65
|
-
this.toDispose.push(this.content);
|
|
66
|
-
layout.addWidget(this.content);
|
|
67
|
-
const inputWidget = new browser_1.Widget();
|
|
68
|
-
inputWidget.node.classList.add(ConsoleWidget_1.styles.input);
|
|
69
|
-
layout.addWidget(inputWidget);
|
|
70
|
-
const input = this._input = await this.createInput(inputWidget.node);
|
|
71
|
-
this.toDispose.push(input);
|
|
72
|
-
this.toDispose.push(input.getControl().onDidLayoutChange(() => this.resizeContent()));
|
|
73
|
-
this.toDispose.push(input.getControl().onDidChangeConfiguration(event => {
|
|
74
|
-
if (event.hasChanged(monaco.editor.EditorOption.fontInfo)) {
|
|
75
|
-
this.updateFont();
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
this.session = this.sessionManager.selectedSession;
|
|
79
|
-
this.toDispose.push(this.sessionManager.onDidChangeSelectedSession(session => {
|
|
80
|
-
// Do not clear the session output when `undefined`.
|
|
81
|
-
if (session) {
|
|
82
|
-
this.session = session;
|
|
83
|
-
}
|
|
84
|
-
}));
|
|
85
|
-
this.updateFont();
|
|
86
|
-
if (inputFocusContextKey) {
|
|
87
|
-
this.toDispose.push(input.onFocusChanged(() => inputFocusContextKey.set(this.hasInputFocus())));
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
createInput(node) {
|
|
91
|
-
return this.editorProvider.createInline(this.options.input.uri, node, this.options.input.options);
|
|
92
|
-
}
|
|
93
|
-
updateFont() {
|
|
94
|
-
const { fontFamily, fontSize, lineHeight } = this._input.getControl().getOption(monaco.editor.EditorOption.fontInfo);
|
|
95
|
-
this.content.node.style.fontFamily = fontFamily;
|
|
96
|
-
this.content.node.style.fontSize = fontSize + 'px';
|
|
97
|
-
this.content.node.style.lineHeight = lineHeight + 'px';
|
|
98
|
-
}
|
|
99
|
-
set session(session) {
|
|
100
|
-
if (this._session === session) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
this._session = session;
|
|
104
|
-
this.content.source = session;
|
|
105
|
-
}
|
|
106
|
-
get session() {
|
|
107
|
-
return this._session;
|
|
108
|
-
}
|
|
109
|
-
get input() {
|
|
110
|
-
return this._input;
|
|
111
|
-
}
|
|
112
|
-
selectAll() {
|
|
113
|
-
const selection = document.getSelection();
|
|
114
|
-
if (selection) {
|
|
115
|
-
selection.selectAllChildren(this.content.node);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
collapseAll() {
|
|
119
|
-
const { root } = this.content.model;
|
|
120
|
-
if (browser_1.CompositeTreeNode.is(root)) {
|
|
121
|
-
this.content.model.collapseAll(root);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
clear() {
|
|
125
|
-
if (this.session) {
|
|
126
|
-
this.session.clear();
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
async execute() {
|
|
130
|
-
const value = this._input.getControl().getValue();
|
|
131
|
-
this._input.getControl().setValue('');
|
|
132
|
-
this.history.push(value);
|
|
133
|
-
if (this.session) {
|
|
134
|
-
const listener = this.content.model.onNodeRefreshed(() => {
|
|
135
|
-
listener.dispose();
|
|
136
|
-
this.revealLastOutput();
|
|
137
|
-
});
|
|
138
|
-
await this.session.execute(value);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
navigateBack() {
|
|
142
|
-
const value = this.history.previous;
|
|
143
|
-
if (value === undefined) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
const editor = this.input.getControl();
|
|
147
|
-
editor.setValue(value);
|
|
148
|
-
editor.setPosition({
|
|
149
|
-
lineNumber: 1,
|
|
150
|
-
column: 1
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
navigateForward() {
|
|
154
|
-
const value = this.history.next || '';
|
|
155
|
-
const editor = this.input.getControl();
|
|
156
|
-
editor.setValue(value);
|
|
157
|
-
const lineNumber = editor.getModel().getLineCount();
|
|
158
|
-
const column = editor.getModel().getLineMaxColumn(lineNumber);
|
|
159
|
-
editor.setPosition({ lineNumber, column });
|
|
160
|
-
}
|
|
161
|
-
revealLastOutput() {
|
|
162
|
-
const { root } = this.content.model;
|
|
163
|
-
if (source_tree_1.TreeSourceNode.is(root)) {
|
|
164
|
-
this.content.model.selectNode(root.children[root.children.length - 1]);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
onActivateRequest(msg) {
|
|
168
|
-
super.onActivateRequest(msg);
|
|
169
|
-
this._input.focus();
|
|
170
|
-
}
|
|
171
|
-
onResize(msg) {
|
|
172
|
-
super.onResize(msg);
|
|
173
|
-
this.totalWidth = msg.width;
|
|
174
|
-
this.totalHeight = msg.height;
|
|
175
|
-
this._input.resizeToFit();
|
|
176
|
-
this.resizeContent();
|
|
177
|
-
}
|
|
178
|
-
resizeContent() {
|
|
179
|
-
this.totalHeight = this.totalHeight < 0 ? this.computeHeight() : this.totalHeight;
|
|
180
|
-
const inputHeight = this._input.getControl().getLayoutInfo().height;
|
|
181
|
-
const contentHeight = this.totalHeight - inputHeight;
|
|
182
|
-
this.content.node.style.height = `${contentHeight}px`;
|
|
183
|
-
browser_1.MessageLoop.sendMessage(this.content, new browser_1.Widget.ResizeMessage(this.totalWidth, contentHeight));
|
|
184
|
-
}
|
|
185
|
-
computeHeight() {
|
|
186
|
-
const { verticalSum } = domutils_1.ElementExt.boxSizing(this.node);
|
|
187
|
-
return this.node.offsetHeight - verticalSum;
|
|
188
|
-
}
|
|
189
|
-
storeState() {
|
|
190
|
-
const history = this.history.store();
|
|
191
|
-
const input = this.input.storeViewState();
|
|
192
|
-
return {
|
|
193
|
-
history,
|
|
194
|
-
input
|
|
195
|
-
};
|
|
196
|
-
}
|
|
197
|
-
restoreState(oldState) {
|
|
198
|
-
if ('history' in oldState) {
|
|
199
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
200
|
-
this.history.restore(oldState['history']);
|
|
201
|
-
}
|
|
202
|
-
this.input.getControl().setValue(this.history.current || '');
|
|
203
|
-
if ('input' in oldState) {
|
|
204
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
205
|
-
this.input.restoreViewState(oldState['input']);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
hasInputFocus() {
|
|
209
|
-
return this._input && this._input.isFocused({ strict: true });
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
ConsoleWidget.styles = {
|
|
213
|
-
node: 'theia-console-widget',
|
|
214
|
-
content: 'theia-console-content',
|
|
215
|
-
input: 'theia-console-input',
|
|
216
|
-
};
|
|
217
|
-
__decorate([
|
|
218
|
-
(0, inversify_1.inject)(exports.ConsoleOptions),
|
|
219
|
-
__metadata("design:type", Object)
|
|
220
|
-
], ConsoleWidget.prototype, "options", void 0);
|
|
221
|
-
__decorate([
|
|
222
|
-
(0, inversify_1.inject)(console_content_widget_1.ConsoleContentWidget),
|
|
223
|
-
__metadata("design:type", console_content_widget_1.ConsoleContentWidget)
|
|
224
|
-
], ConsoleWidget.prototype, "content", void 0);
|
|
225
|
-
__decorate([
|
|
226
|
-
(0, inversify_1.inject)(console_history_1.ConsoleHistory),
|
|
227
|
-
__metadata("design:type", console_history_1.ConsoleHistory)
|
|
228
|
-
], ConsoleWidget.prototype, "history", void 0);
|
|
229
|
-
__decorate([
|
|
230
|
-
(0, inversify_1.inject)(console_session_manager_1.ConsoleSessionManager),
|
|
231
|
-
__metadata("design:type", console_session_manager_1.ConsoleSessionManager)
|
|
232
|
-
], ConsoleWidget.prototype, "sessionManager", void 0);
|
|
233
|
-
__decorate([
|
|
234
|
-
(0, inversify_1.inject)(monaco_editor_provider_1.MonacoEditorProvider),
|
|
235
|
-
__metadata("design:type", monaco_editor_provider_1.MonacoEditorProvider)
|
|
236
|
-
], ConsoleWidget.prototype, "editorProvider", void 0);
|
|
237
|
-
__decorate([
|
|
238
|
-
(0, inversify_1.postConstruct)(),
|
|
239
|
-
__metadata("design:type", Function),
|
|
240
|
-
__metadata("design:paramtypes", []),
|
|
241
|
-
__metadata("design:returntype", Promise)
|
|
242
|
-
], ConsoleWidget.prototype, "init", null);
|
|
243
|
-
ConsoleWidget = ConsoleWidget_1 = __decorate([
|
|
244
|
-
(0, inversify_1.injectable)(),
|
|
245
|
-
__metadata("design:paramtypes", [])
|
|
246
|
-
], ConsoleWidget);
|
|
247
|
-
exports.ConsoleWidget = ConsoleWidget;
|
|
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 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 ConsoleWidget_1;
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.ConsoleWidget = exports.ConsoleOptions = void 0;
|
|
29
|
+
const domutils_1 = require("@theia/core/shared/@phosphor/domutils");
|
|
30
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
31
|
+
const source_tree_1 = require("@theia/core/lib/browser/source-tree");
|
|
32
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
33
|
+
const monaco_editor_provider_1 = require("@theia/monaco/lib/browser/monaco-editor-provider");
|
|
34
|
+
const console_history_1 = require("./console-history");
|
|
35
|
+
const console_content_widget_1 = require("./console-content-widget");
|
|
36
|
+
const console_session_manager_1 = require("./console-session-manager");
|
|
37
|
+
const monaco = require("@theia/monaco-editor-core");
|
|
38
|
+
exports.ConsoleOptions = Symbol('ConsoleWidgetOptions');
|
|
39
|
+
let ConsoleWidget = ConsoleWidget_1 = class ConsoleWidget extends browser_1.BaseWidget {
|
|
40
|
+
constructor() {
|
|
41
|
+
super();
|
|
42
|
+
this.totalHeight = -1;
|
|
43
|
+
this.totalWidth = -1;
|
|
44
|
+
this.node.classList.add(ConsoleWidget_1.styles.node);
|
|
45
|
+
}
|
|
46
|
+
static createContainer(parent, options) {
|
|
47
|
+
const child = console_content_widget_1.ConsoleContentWidget.createContainer(parent);
|
|
48
|
+
child.bind(console_history_1.ConsoleHistory).toSelf();
|
|
49
|
+
child.bind(exports.ConsoleOptions).toConstantValue(options);
|
|
50
|
+
child.bind(ConsoleWidget_1).toSelf();
|
|
51
|
+
return child;
|
|
52
|
+
}
|
|
53
|
+
async init() {
|
|
54
|
+
const { id, title, inputFocusContextKey } = this.options;
|
|
55
|
+
const { label, iconClass, caption } = Object.assign({}, title);
|
|
56
|
+
this.id = id;
|
|
57
|
+
this.title.closable = true;
|
|
58
|
+
this.title.label = label || id;
|
|
59
|
+
if (iconClass) {
|
|
60
|
+
this.title.iconClass = iconClass;
|
|
61
|
+
}
|
|
62
|
+
this.title.caption = caption || label || id;
|
|
63
|
+
const layout = this.layout = new browser_1.PanelLayout();
|
|
64
|
+
this.content.node.classList.add(ConsoleWidget_1.styles.content);
|
|
65
|
+
this.toDispose.push(this.content);
|
|
66
|
+
layout.addWidget(this.content);
|
|
67
|
+
const inputWidget = new browser_1.Widget();
|
|
68
|
+
inputWidget.node.classList.add(ConsoleWidget_1.styles.input);
|
|
69
|
+
layout.addWidget(inputWidget);
|
|
70
|
+
const input = this._input = await this.createInput(inputWidget.node);
|
|
71
|
+
this.toDispose.push(input);
|
|
72
|
+
this.toDispose.push(input.getControl().onDidLayoutChange(() => this.resizeContent()));
|
|
73
|
+
this.toDispose.push(input.getControl().onDidChangeConfiguration(event => {
|
|
74
|
+
if (event.hasChanged(monaco.editor.EditorOption.fontInfo)) {
|
|
75
|
+
this.updateFont();
|
|
76
|
+
}
|
|
77
|
+
}));
|
|
78
|
+
this.session = this.sessionManager.selectedSession;
|
|
79
|
+
this.toDispose.push(this.sessionManager.onDidChangeSelectedSession(session => {
|
|
80
|
+
// Do not clear the session output when `undefined`.
|
|
81
|
+
if (session) {
|
|
82
|
+
this.session = session;
|
|
83
|
+
}
|
|
84
|
+
}));
|
|
85
|
+
this.updateFont();
|
|
86
|
+
if (inputFocusContextKey) {
|
|
87
|
+
this.toDispose.push(input.onFocusChanged(() => inputFocusContextKey.set(this.hasInputFocus())));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
createInput(node) {
|
|
91
|
+
return this.editorProvider.createInline(this.options.input.uri, node, this.options.input.options);
|
|
92
|
+
}
|
|
93
|
+
updateFont() {
|
|
94
|
+
const { fontFamily, fontSize, lineHeight } = this._input.getControl().getOption(monaco.editor.EditorOption.fontInfo);
|
|
95
|
+
this.content.node.style.fontFamily = fontFamily;
|
|
96
|
+
this.content.node.style.fontSize = fontSize + 'px';
|
|
97
|
+
this.content.node.style.lineHeight = lineHeight + 'px';
|
|
98
|
+
}
|
|
99
|
+
set session(session) {
|
|
100
|
+
if (this._session === session) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this._session = session;
|
|
104
|
+
this.content.source = session;
|
|
105
|
+
}
|
|
106
|
+
get session() {
|
|
107
|
+
return this._session;
|
|
108
|
+
}
|
|
109
|
+
get input() {
|
|
110
|
+
return this._input;
|
|
111
|
+
}
|
|
112
|
+
selectAll() {
|
|
113
|
+
const selection = document.getSelection();
|
|
114
|
+
if (selection) {
|
|
115
|
+
selection.selectAllChildren(this.content.node);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
collapseAll() {
|
|
119
|
+
const { root } = this.content.model;
|
|
120
|
+
if (browser_1.CompositeTreeNode.is(root)) {
|
|
121
|
+
this.content.model.collapseAll(root);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
clear() {
|
|
125
|
+
if (this.session) {
|
|
126
|
+
this.session.clear();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async execute() {
|
|
130
|
+
const value = this._input.getControl().getValue();
|
|
131
|
+
this._input.getControl().setValue('');
|
|
132
|
+
this.history.push(value);
|
|
133
|
+
if (this.session) {
|
|
134
|
+
const listener = this.content.model.onNodeRefreshed(() => {
|
|
135
|
+
listener.dispose();
|
|
136
|
+
this.revealLastOutput();
|
|
137
|
+
});
|
|
138
|
+
await this.session.execute(value);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
navigateBack() {
|
|
142
|
+
const value = this.history.previous;
|
|
143
|
+
if (value === undefined) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const editor = this.input.getControl();
|
|
147
|
+
editor.setValue(value);
|
|
148
|
+
editor.setPosition({
|
|
149
|
+
lineNumber: 1,
|
|
150
|
+
column: 1
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
navigateForward() {
|
|
154
|
+
const value = this.history.next || '';
|
|
155
|
+
const editor = this.input.getControl();
|
|
156
|
+
editor.setValue(value);
|
|
157
|
+
const lineNumber = editor.getModel().getLineCount();
|
|
158
|
+
const column = editor.getModel().getLineMaxColumn(lineNumber);
|
|
159
|
+
editor.setPosition({ lineNumber, column });
|
|
160
|
+
}
|
|
161
|
+
revealLastOutput() {
|
|
162
|
+
const { root } = this.content.model;
|
|
163
|
+
if (source_tree_1.TreeSourceNode.is(root)) {
|
|
164
|
+
this.content.model.selectNode(root.children[root.children.length - 1]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
onActivateRequest(msg) {
|
|
168
|
+
super.onActivateRequest(msg);
|
|
169
|
+
this._input.focus();
|
|
170
|
+
}
|
|
171
|
+
onResize(msg) {
|
|
172
|
+
super.onResize(msg);
|
|
173
|
+
this.totalWidth = msg.width;
|
|
174
|
+
this.totalHeight = msg.height;
|
|
175
|
+
this._input.resizeToFit();
|
|
176
|
+
this.resizeContent();
|
|
177
|
+
}
|
|
178
|
+
resizeContent() {
|
|
179
|
+
this.totalHeight = this.totalHeight < 0 ? this.computeHeight() : this.totalHeight;
|
|
180
|
+
const inputHeight = this._input.getControl().getLayoutInfo().height;
|
|
181
|
+
const contentHeight = this.totalHeight - inputHeight;
|
|
182
|
+
this.content.node.style.height = `${contentHeight}px`;
|
|
183
|
+
browser_1.MessageLoop.sendMessage(this.content, new browser_1.Widget.ResizeMessage(this.totalWidth, contentHeight));
|
|
184
|
+
}
|
|
185
|
+
computeHeight() {
|
|
186
|
+
const { verticalSum } = domutils_1.ElementExt.boxSizing(this.node);
|
|
187
|
+
return this.node.offsetHeight - verticalSum;
|
|
188
|
+
}
|
|
189
|
+
storeState() {
|
|
190
|
+
const history = this.history.store();
|
|
191
|
+
const input = this.input.storeViewState();
|
|
192
|
+
return {
|
|
193
|
+
history,
|
|
194
|
+
input
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
restoreState(oldState) {
|
|
198
|
+
if ('history' in oldState) {
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
200
|
+
this.history.restore(oldState['history']);
|
|
201
|
+
}
|
|
202
|
+
this.input.getControl().setValue(this.history.current || '');
|
|
203
|
+
if ('input' in oldState) {
|
|
204
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
205
|
+
this.input.restoreViewState(oldState['input']);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
hasInputFocus() {
|
|
209
|
+
return this._input && this._input.isFocused({ strict: true });
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
ConsoleWidget.styles = {
|
|
213
|
+
node: 'theia-console-widget',
|
|
214
|
+
content: 'theia-console-content',
|
|
215
|
+
input: 'theia-console-input',
|
|
216
|
+
};
|
|
217
|
+
__decorate([
|
|
218
|
+
(0, inversify_1.inject)(exports.ConsoleOptions),
|
|
219
|
+
__metadata("design:type", Object)
|
|
220
|
+
], ConsoleWidget.prototype, "options", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
(0, inversify_1.inject)(console_content_widget_1.ConsoleContentWidget),
|
|
223
|
+
__metadata("design:type", console_content_widget_1.ConsoleContentWidget)
|
|
224
|
+
], ConsoleWidget.prototype, "content", void 0);
|
|
225
|
+
__decorate([
|
|
226
|
+
(0, inversify_1.inject)(console_history_1.ConsoleHistory),
|
|
227
|
+
__metadata("design:type", console_history_1.ConsoleHistory)
|
|
228
|
+
], ConsoleWidget.prototype, "history", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
(0, inversify_1.inject)(console_session_manager_1.ConsoleSessionManager),
|
|
231
|
+
__metadata("design:type", console_session_manager_1.ConsoleSessionManager)
|
|
232
|
+
], ConsoleWidget.prototype, "sessionManager", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
(0, inversify_1.inject)(monaco_editor_provider_1.MonacoEditorProvider),
|
|
235
|
+
__metadata("design:type", monaco_editor_provider_1.MonacoEditorProvider)
|
|
236
|
+
], ConsoleWidget.prototype, "editorProvider", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
(0, inversify_1.postConstruct)(),
|
|
239
|
+
__metadata("design:type", Function),
|
|
240
|
+
__metadata("design:paramtypes", []),
|
|
241
|
+
__metadata("design:returntype", Promise)
|
|
242
|
+
], ConsoleWidget.prototype, "init", null);
|
|
243
|
+
ConsoleWidget = ConsoleWidget_1 = __decorate([
|
|
244
|
+
(0, inversify_1.injectable)(),
|
|
245
|
+
__metadata("design:paramtypes", [])
|
|
246
|
+
], ConsoleWidget);
|
|
247
|
+
exports.ConsoleWidget = ConsoleWidget;
|
|
248
248
|
//# sourceMappingURL=console-widget.js.map
|
package/lib/package.spec.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
/* note: this bogus test file is required so that
|
|
17
|
-
we are able to run mocha unit tests on this
|
|
18
|
-
package, without having any actual unit tests in it.
|
|
19
|
-
This way a coverage report will be generated,
|
|
20
|
-
showing 0% coverage, instead of no report.
|
|
21
|
-
This file can be removed once we have real unit
|
|
22
|
-
tests in place. */
|
|
23
|
-
describe('console package', () => {
|
|
24
|
-
it('support code coverage statistics', () => true);
|
|
25
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
/* note: this bogus test file is required so that
|
|
17
|
+
we are able to run mocha unit tests on this
|
|
18
|
+
package, without having any actual unit tests in it.
|
|
19
|
+
This way a coverage report will be generated,
|
|
20
|
+
showing 0% coverage, instead of no report.
|
|
21
|
+
This file can be removed once we have real unit
|
|
22
|
+
tests in place. */
|
|
23
|
+
describe('console package', () => {
|
|
24
|
+
it('support code coverage statistics', () => true);
|
|
25
|
+
});
|
|
26
26
|
//# sourceMappingURL=package.spec.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/console",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.3",
|
|
4
4
|
"description": "Theia - Console Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.34.
|
|
7
|
-
"@theia/monaco": "1.34.
|
|
6
|
+
"@theia/core": "1.34.3",
|
|
7
|
+
"@theia/monaco": "1.34.3",
|
|
8
8
|
"@theia/monaco-editor-core": "1.72.3",
|
|
9
9
|
"anser": "^2.0.1"
|
|
10
10
|
},
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"watch": "theiaext watch"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@theia/ext-scripts": "1.34.
|
|
44
|
+
"@theia/ext-scripts": "1.34.3"
|
|
45
45
|
},
|
|
46
46
|
"nyc": {
|
|
47
47
|
"extends": "../../configs/nyc.json"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a6cf9fe96b1624d6e27a11dce2ebdeae820478e5"
|
|
50
50
|
}
|