@opensumi/ide-terminal-next 3.7.2-next-1740052080.0 → 3.7.2-next-1740054042.0
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 +21 -0
- package/lib/browser/component/resize.delegate.d.ts +14 -0
- package/lib/browser/component/resize.delegate.d.ts.map +1 -0
- package/lib/browser/component/resize.delegate.js +46 -0
- package/lib/browser/component/resize.delegate.js.map +1 -0
- package/lib/browser/component/resize.module.less +77 -0
- package/lib/browser/component/resize.view.d.ts +16 -0
- package/lib/browser/component/resize.view.d.ts.map +1 -0
- package/lib/browser/component/resize.view.js +55 -0
- package/lib/browser/component/resize.view.js.map +1 -0
- package/lib/browser/component/search.module.less +61 -0
- package/lib/browser/component/search.view.d.ts +3 -0
- package/lib/browser/component/search.view.d.ts.map +1 -0
- package/lib/browser/component/search.view.js +89 -0
- package/lib/browser/component/search.view.js.map +1 -0
- package/lib/browser/component/tab.item.d.ts +7 -0
- package/lib/browser/component/tab.item.d.ts.map +1 -0
- package/lib/browser/component/tab.item.js +121 -0
- package/lib/browser/component/tab.item.js.map +1 -0
- package/lib/browser/component/tab.module.less +174 -0
- package/lib/browser/component/tab.view.d.ts +4 -0
- package/lib/browser/component/tab.view.d.ts.map +1 -0
- package/lib/browser/component/tab.view.js +65 -0
- package/lib/browser/component/tab.view.js.map +1 -0
- package/lib/browser/component/terminal.module.less +50 -0
- package/lib/browser/component/terminal.variable.d.ts +8 -0
- package/lib/browser/component/terminal.variable.d.ts.map +1 -0
- package/lib/browser/component/terminal.variable.js +44 -0
- package/lib/browser/component/terminal.variable.js.map +1 -0
- package/lib/browser/component/terminal.view.d.ts +5 -0
- package/lib/browser/component/terminal.view.d.ts.map +1 -0
- package/lib/browser/component/terminal.view.js +63 -0
- package/lib/browser/component/terminal.view.js.map +1 -0
- package/lib/browser/component/terminal.widget.d.ts +10 -0
- package/lib/browser/component/terminal.widget.d.ts.map +1 -0
- package/lib/browser/component/terminal.widget.js +65 -0
- package/lib/browser/component/terminal.widget.js.map +1 -0
- package/lib/browser/component/variable.module.less +15 -0
- package/lib/browser/contribution/index.d.ts.map +1 -0
- package/lib/browser/contribution/index.js +11 -0
- package/lib/browser/contribution/index.js.map +1 -0
- package/lib/browser/contribution/terminal.command.js +328 -0
- package/lib/browser/contribution/terminal.keybinding.js +87 -0
- package/lib/browser/contribution/terminal.lifecycle.js +52 -0
- package/lib/browser/contribution/terminal.menu.js +168 -0
- package/lib/browser/contribution/terminal.network.js +44 -0
- package/lib/browser/contribution/terminal.preference.js +43 -0
- package/lib/browser/contribution/terminal.view.js +57 -0
- package/lib/browser/index.js +124 -0
- package/lib/browser/links/base.d.ts +8 -0
- package/lib/browser/links/base.d.ts.map +1 -0
- package/lib/browser/links/base.js +13 -0
- package/lib/browser/links/base.js.map +1 -0
- package/lib/browser/links/external-link-provider-adapter.d.ts +21 -0
- package/lib/browser/links/external-link-provider-adapter.d.ts.map +1 -0
- package/lib/browser/links/external-link-provider-adapter.js +74 -0
- package/lib/browser/links/external-link-provider-adapter.js.map +1 -0
- package/lib/browser/links/helpers.d.ts +7 -0
- package/lib/browser/links/helpers.d.ts.map +1 -0
- package/lib/browser/links/helpers.js +128 -0
- package/lib/browser/links/helpers.js.map +1 -0
- package/lib/browser/links/link-manager.d.ts +92 -0
- package/lib/browser/links/link-manager.d.ts.map +1 -0
- package/lib/browser/links/link-manager.js +342 -0
- package/lib/browser/links/link-manager.js.map +1 -0
- package/lib/browser/links/link.d.ts +31 -0
- package/lib/browser/links/link.d.ts.map +1 -0
- package/lib/browser/links/link.js +136 -0
- package/lib/browser/links/link.js.map +1 -0
- package/lib/browser/links/protocol-link-provider.d.ts +14 -0
- package/lib/browser/links/protocol-link-provider.d.ts.map +1 -0
- package/lib/browser/links/protocol-link-provider.js +71 -0
- package/lib/browser/links/protocol-link-provider.js.map +1 -0
- package/lib/browser/links/validated-local-link-provider.d.ts +41 -0
- package/lib/browser/links/validated-local-link-provider.d.ts.map +1 -0
- package/lib/browser/links/validated-local-link-provider.js +235 -0
- package/lib/browser/links/validated-local-link-provider.js.map +1 -0
- package/lib/browser/links/word-link-provider.d.ts +29 -0
- package/lib/browser/links/word-link-provider.d.ts.map +1 -0
- package/lib/browser/links/word-link-provider.js +153 -0
- package/lib/browser/links/word-link-provider.js.map +1 -0
- package/lib/browser/terminal.addon.js +83 -0
- package/lib/browser/terminal.api.js +162 -0
- package/lib/browser/terminal.client.js +680 -0
- package/lib/browser/terminal.color.js +240 -0
- package/lib/browser/terminal.context-key.js +29 -0
- package/lib/browser/terminal.context-menu.js +96 -0
- package/lib/browser/terminal.controller.js +669 -0
- package/lib/browser/terminal.environment.service.js +153 -0
- package/lib/browser/terminal.error.js +61 -0
- package/lib/browser/terminal.ext.host.proxy.js +108 -0
- package/lib/browser/terminal.hover.manager.js +85 -0
- package/lib/browser/terminal.input.js +32 -0
- package/lib/browser/terminal.internal.service.js +107 -0
- package/lib/browser/terminal.network.js +150 -0
- package/lib/browser/terminal.preference.js +136 -0
- package/lib/browser/terminal.profile.internal.js +104 -0
- package/lib/browser/terminal.profile.js +211 -0
- package/lib/browser/terminal.render.js +25 -0
- package/lib/browser/terminal.restore.js +49 -0
- package/lib/browser/terminal.search.js +109 -0
- package/lib/browser/terminal.service.js +163 -0
- package/lib/common/api.d.ts +22 -0
- package/lib/common/api.d.ts.map +1 -0
- package/lib/common/api.js +5 -0
- package/lib/common/api.js.map +1 -0
- package/lib/common/client.d.ts +199 -0
- package/lib/common/client.d.ts.map +1 -0
- package/lib/common/client.js +6 -0
- package/lib/common/client.js.map +1 -0
- package/lib/common/controller.d.ts +149 -0
- package/lib/common/controller.d.ts.map +1 -0
- package/lib/common/controller.js +8 -0
- package/lib/common/controller.js.map +1 -0
- package/lib/common/environmentVariable.d.ts +116 -0
- package/lib/common/environmentVariable.d.ts.map +1 -0
- package/lib/common/environmentVariable.js +30 -0
- package/lib/common/environmentVariable.js.map +1 -0
- package/lib/common/environmentVariableCollection.d.ts +9 -0
- package/lib/common/environmentVariableCollection.d.ts.map +1 -0
- package/lib/common/environmentVariableCollection.js +140 -0
- package/lib/common/environmentVariableCollection.js.map +1 -0
- package/lib/common/error.d.ts +41 -0
- package/lib/common/error.d.ts.map +1 -0
- package/lib/common/error.js +13 -0
- package/lib/common/error.js.map +1 -0
- package/lib/common/extension.d.ts +139 -0
- package/lib/common/extension.d.ts.map +1 -0
- package/lib/common/extension.js +57 -0
- package/lib/common/extension.js.map +1 -0
- package/lib/common/index.d.ts +17 -0
- package/lib/common/index.d.ts.map +1 -0
- package/lib/common/index.js +20 -0
- package/lib/common/index.js.map +1 -0
- package/lib/common/link-computer.d.ts +56 -0
- package/lib/common/link-computer.d.ts.map +1 -0
- package/lib/common/link-computer.js +282 -0
- package/lib/common/link-computer.js.map +1 -0
- package/lib/common/network.d.ts +48 -0
- package/lib/common/network.d.ts.map +1 -0
- package/lib/common/network.js +10 -0
- package/lib/common/network.js.map +1 -0
- package/lib/common/preference.d.ts +134 -0
- package/lib/common/preference.d.ts.map +1 -0
- package/lib/common/preference.js +199 -0
- package/lib/common/preference.js.map +1 -0
- package/lib/common/process.d.ts +8 -0
- package/lib/common/process.d.ts.map +1 -0
- package/lib/common/process.js +3 -0
- package/lib/common/process.js.map +1 -0
- package/lib/common/profile.d.ts +99 -0
- package/lib/common/profile.d.ts.map +1 -0
- package/lib/common/profile.js +27 -0
- package/lib/common/profile.js.map +1 -0
- package/lib/common/pty.d.ts +525 -0
- package/lib/common/pty.d.ts.map +1 -0
- package/lib/common/pty.js +28 -0
- package/lib/common/pty.js.map +1 -0
- package/lib/common/render.d.ts +29 -0
- package/lib/common/render.d.ts.map +1 -0
- package/lib/common/render.js +10 -0
- package/lib/common/render.js.map +1 -0
- package/lib/common/resize.d.ts +43 -0
- package/lib/common/resize.d.ts.map +1 -0
- package/lib/common/resize.js +3 -0
- package/lib/common/resize.js.map +1 -0
- package/lib/common/restore.d.ts +6 -0
- package/lib/common/restore.d.ts.map +1 -0
- package/lib/common/restore.js +5 -0
- package/lib/common/restore.js.map +1 -0
- package/lib/common/service.d.ts +96 -0
- package/lib/common/service.d.ts.map +1 -0
- package/lib/common/service.js +6 -0
- package/lib/common/service.js.map +1 -0
- package/lib/common/shell.d.ts +11 -0
- package/lib/common/shell.d.ts.map +1 -0
- package/lib/common/shell.js +14 -0
- package/lib/common/shell.js.map +1 -0
- package/lib/common/theme.d.ts +6 -0
- package/lib/common/theme.d.ts.map +1 -0
- package/lib/common/theme.js +5 -0
- package/lib/common/theme.js.map +1 -0
- package/lib/common/utils.d.ts +4 -0
- package/lib/common/utils.d.ts.map +1 -0
- package/lib/common/utils.js +15 -0
- package/lib/common/utils.js.map +1 -0
- package/lib/common/xterm.d.ts +27 -0
- package/lib/common/xterm.d.ts.map +1 -0
- package/lib/common/xterm.js +10 -0
- package/lib/common/xterm.js.map +1 -0
- package/lib/index.js +5 -0
- package/lib/node/data-store.d.ts +13 -0
- package/lib/node/data-store.d.ts.map +1 -0
- package/lib/node/data-store.js +6 -0
- package/lib/node/data-store.js.map +1 -0
- package/lib/node/index.d.ts +10 -0
- package/lib/node/index.d.ts.map +1 -0
- package/lib/node/index.js +64 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/pty.d.ts +42 -0
- package/lib/node/pty.d.ts.map +1 -0
- package/lib/node/pty.js +277 -0
- package/lib/node/pty.js.map +1 -0
- package/lib/node/pty.manager.d.ts +52 -0
- package/lib/node/pty.manager.d.ts.map +1 -0
- package/lib/node/pty.manager.js +157 -0
- package/lib/node/pty.manager.js.map +1 -0
- package/lib/node/pty.manager.remote.d.ts +23 -0
- package/lib/node/pty.manager.remote.d.ts.map +1 -0
- package/lib/node/pty.manager.remote.js +124 -0
- package/lib/node/pty.manager.remote.js.map +1 -0
- package/lib/node/pty.proxy.d.ts +45 -0
- package/lib/node/pty.proxy.d.ts.map +1 -0
- package/lib/node/pty.proxy.js +277 -0
- package/lib/node/pty.proxy.js.map +1 -0
- package/lib/node/pty.proxy.remote.exec.d.ts +2 -0
- package/lib/node/pty.proxy.remote.exec.d.ts.map +1 -0
- package/lib/node/pty.proxy.remote.exec.js +7 -0
- package/lib/node/pty.proxy.remote.exec.js.map +1 -0
- package/lib/node/shell-integration.service.d.ts +24 -0
- package/lib/node/shell-integration.service.d.ts.map +1 -0
- package/lib/node/shell-integration.service.js +187 -0
- package/lib/node/shell-integration.service.js.map +1 -0
- package/lib/node/shell.d.ts +20 -0
- package/lib/node/shell.d.ts.map +1 -0
- package/lib/node/shell.js +199 -0
- package/lib/node/shell.js.map +1 -0
- package/lib/node/terminal.process.service.d.ts +5 -0
- package/lib/node/terminal.process.service.d.ts.map +1 -0
- package/lib/node/terminal.process.service.js +15 -0
- package/lib/node/terminal.process.service.js.map +1 -0
- package/lib/node/terminal.profile.service.d.ts +19 -0
- package/lib/node/terminal.profile.service.d.ts.map +1 -0
- package/lib/node/terminal.profile.service.js +228 -0
- package/lib/node/terminal.profile.service.js.map +1 -0
- package/lib/node/terminal.service.client.d.ts +51 -0
- package/lib/node/terminal.service.client.d.ts.map +1 -0
- package/lib/node/terminal.service.client.js +159 -0
- package/lib/node/terminal.service.client.js.map +1 -0
- package/lib/node/terminal.service.d.ts +30 -0
- package/lib/node/terminal.service.d.ts.map +1 -0
- package/lib/node/terminal.service.js +246 -0
- package/lib/node/terminal.service.js.map +1 -0
- package/package.json +18 -18
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TerminalSearchService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
let TerminalSearchService = class TerminalSearchService {
|
|
9
|
+
constructor() {
|
|
10
|
+
this._isVisible = false;
|
|
11
|
+
this.UIState = {
|
|
12
|
+
isMatchCase: false,
|
|
13
|
+
isUseRegexp: false,
|
|
14
|
+
isWholeWord: false,
|
|
15
|
+
};
|
|
16
|
+
this._onVisibleChange = new ide_core_common_1.Emitter();
|
|
17
|
+
this.onVisibleChange = this._onVisibleChange.event;
|
|
18
|
+
this.text = '';
|
|
19
|
+
}
|
|
20
|
+
get isVisible() {
|
|
21
|
+
return this._isVisible;
|
|
22
|
+
}
|
|
23
|
+
set isVisible(value) {
|
|
24
|
+
this._isVisible = value;
|
|
25
|
+
this._onVisibleChange.fire(value);
|
|
26
|
+
}
|
|
27
|
+
get client() {
|
|
28
|
+
return this.controller.findClientFromWidgetId(this.terminalView.currentWidget.get().id);
|
|
29
|
+
}
|
|
30
|
+
open() {
|
|
31
|
+
this.isVisible = true;
|
|
32
|
+
}
|
|
33
|
+
get onResultChange() {
|
|
34
|
+
var _a;
|
|
35
|
+
return (_a = this.client) === null || _a === void 0 ? void 0 : _a.onSearchResultsChange;
|
|
36
|
+
}
|
|
37
|
+
close() {
|
|
38
|
+
var _a;
|
|
39
|
+
(_a = this.client) === null || _a === void 0 ? void 0 : _a.closeSearch();
|
|
40
|
+
this.isVisible = false;
|
|
41
|
+
}
|
|
42
|
+
clear() {
|
|
43
|
+
var _a;
|
|
44
|
+
(_a = this.client) === null || _a === void 0 ? void 0 : _a.closeSearch();
|
|
45
|
+
this.text = '';
|
|
46
|
+
}
|
|
47
|
+
search() {
|
|
48
|
+
var _a;
|
|
49
|
+
(_a = this.client) === null || _a === void 0 ? void 0 : _a.findNext(this.text, {
|
|
50
|
+
wholeWord: this.UIState.isWholeWord,
|
|
51
|
+
regex: this.UIState.isUseRegexp,
|
|
52
|
+
caseSensitive: this.UIState.isMatchCase,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
searchPrevious() {
|
|
56
|
+
var _a;
|
|
57
|
+
(_a = this.client) === null || _a === void 0 ? void 0 : _a.findPrevious(this.text, {
|
|
58
|
+
wholeWord: this.UIState.isWholeWord,
|
|
59
|
+
regex: this.UIState.isUseRegexp,
|
|
60
|
+
caseSensitive: this.UIState.isMatchCase,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
searchNext() {
|
|
64
|
+
var _a;
|
|
65
|
+
(_a = this.client) === null || _a === void 0 ? void 0 : _a.findNext(this.text, {
|
|
66
|
+
wholeWord: this.UIState.isWholeWord,
|
|
67
|
+
regex: this.UIState.isUseRegexp,
|
|
68
|
+
caseSensitive: this.UIState.isMatchCase,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
updateUIState(state) {
|
|
72
|
+
this.UIState = {
|
|
73
|
+
...this.UIState,
|
|
74
|
+
...state,
|
|
75
|
+
};
|
|
76
|
+
this.search();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
exports.TerminalSearchService = TerminalSearchService;
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, di_1.Autowired)(common_1.ITerminalController),
|
|
82
|
+
tslib_1.__metadata("design:type", Object)
|
|
83
|
+
], TerminalSearchService.prototype, "controller", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, di_1.Autowired)(common_1.ITerminalGroupViewService),
|
|
86
|
+
tslib_1.__metadata("design:type", Object)
|
|
87
|
+
], TerminalSearchService.prototype, "terminalView", void 0);
|
|
88
|
+
tslib_1.__decorate([
|
|
89
|
+
(0, ide_core_common_1.debounce)(150),
|
|
90
|
+
tslib_1.__metadata("design:type", Function),
|
|
91
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
92
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
93
|
+
], TerminalSearchService.prototype, "search", null);
|
|
94
|
+
tslib_1.__decorate([
|
|
95
|
+
(0, ide_core_common_1.debounce)(150),
|
|
96
|
+
tslib_1.__metadata("design:type", Function),
|
|
97
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
98
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
99
|
+
], TerminalSearchService.prototype, "searchPrevious", null);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, ide_core_common_1.debounce)(150),
|
|
102
|
+
tslib_1.__metadata("design:type", Function),
|
|
103
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
104
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
105
|
+
], TerminalSearchService.prototype, "searchNext", null);
|
|
106
|
+
exports.TerminalSearchService = TerminalSearchService = tslib_1.__decorate([
|
|
107
|
+
(0, di_1.Injectable)()
|
|
108
|
+
], TerminalSearchService);
|
|
109
|
+
//# sourceMappingURL=terminal.search.js.map
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var NodePtyTerminalService_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.NodePtyTerminalService = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const di_1 = require("@opensumi/di");
|
|
7
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
8
|
+
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
9
|
+
const common_1 = require("../common");
|
|
10
|
+
let NodePtyTerminalService = NodePtyTerminalService_1 = class NodePtyTerminalService extends ide_core_common_1.Disposable {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this._onError = this.registerDispose(new ide_core_common_1.Emitter());
|
|
14
|
+
this.onError = this._onError.event;
|
|
15
|
+
this._onExit = this.registerDispose(new ide_core_common_1.Emitter());
|
|
16
|
+
this.onExit = this._onExit.event;
|
|
17
|
+
this._onProcessChange = this.registerDispose(new ide_core_common_1.Emitter());
|
|
18
|
+
this.onProcessChange = this._onProcessChange.event;
|
|
19
|
+
this._onDataDispatcher = this.registerDispose(new ide_core_common_1.Dispatcher());
|
|
20
|
+
this._onExitDispatcher = this.registerDispose(new ide_core_common_1.Dispatcher());
|
|
21
|
+
this._createCustomWebSocket = (sessionId, pty) => ({
|
|
22
|
+
name: pty.name,
|
|
23
|
+
readonly: false,
|
|
24
|
+
onData: (handler) => this._onDataDispatcher.on(sessionId)(handler),
|
|
25
|
+
onExit: (handler) => this._onExitDispatcher.on(sessionId)((e) => {
|
|
26
|
+
handler(e.code);
|
|
27
|
+
}),
|
|
28
|
+
sendData: (message) => {
|
|
29
|
+
this.sendText(sessionId, message);
|
|
30
|
+
},
|
|
31
|
+
ptyInstance: pty,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
generateSessionId() {
|
|
35
|
+
return this.applicationService.clientId + common_1.TERMINAL_ID_SEPARATOR + (0, common_1.generateSessionId)();
|
|
36
|
+
}
|
|
37
|
+
async check(ids) {
|
|
38
|
+
const ensureResult = await this.serviceClientRPC.ensureTerminal(ids);
|
|
39
|
+
return ensureResult;
|
|
40
|
+
}
|
|
41
|
+
async attachByLaunchConfig(sessionId, cols, rows, launchConfig, _xterm) {
|
|
42
|
+
// If code runs to here, it means that we want to create a real terminal.
|
|
43
|
+
// So if `launchConfig.executable` is not set, we should use the default shell.
|
|
44
|
+
if (!launchConfig.executable) {
|
|
45
|
+
launchConfig.executable = await this.getDefaultSystemShell();
|
|
46
|
+
}
|
|
47
|
+
this.logger.log(`attach terminal ${sessionId} with launchConfig `, launchConfig);
|
|
48
|
+
const ptyInstance = await this.serviceClientRPC.create2(sessionId, cols, rows, launchConfig);
|
|
49
|
+
if (ptyInstance && (ptyInstance.pid || ptyInstance.name)) {
|
|
50
|
+
this.logger.log(`${sessionId} attach success, pid: ${ptyInstance.pid}, name: ${ptyInstance.name}`);
|
|
51
|
+
// 有 pid 或者 name 的才视为创建成功
|
|
52
|
+
// 创建不成功的时候会被通过 closeClient 把错误信息传递回来
|
|
53
|
+
return this._createCustomWebSocket(sessionId, ptyInstance);
|
|
54
|
+
}
|
|
55
|
+
this.logger.error(`${sessionId} cannot create ptyInstance`, ptyInstance);
|
|
56
|
+
}
|
|
57
|
+
_sendMessage(sessionId, json, requestId) {
|
|
58
|
+
const id = requestId || NodePtyTerminalService_1.countId++;
|
|
59
|
+
this.serviceClientRPC.onMessage(sessionId, JSON.stringify({
|
|
60
|
+
id,
|
|
61
|
+
...json,
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
async sendText(sessionId, message) {
|
|
65
|
+
this._sendMessage(sessionId, {
|
|
66
|
+
data: message,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async resize(sessionId, cols, rows) {
|
|
70
|
+
this._sendMessage(sessionId, {
|
|
71
|
+
method: 'resize',
|
|
72
|
+
params: { cols, rows },
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async getCodePlatformKey() {
|
|
76
|
+
return await this.serviceClientRPC.getCodePlatformKey();
|
|
77
|
+
}
|
|
78
|
+
disposeById(sessionId) {
|
|
79
|
+
this.serviceClientRPC.disposeById(sessionId);
|
|
80
|
+
}
|
|
81
|
+
async getProcessId(sessionId) {
|
|
82
|
+
return this.serviceClientRPC.getProcessId(sessionId);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* for pty node
|
|
86
|
+
*
|
|
87
|
+
* @param sessionId
|
|
88
|
+
* @param message
|
|
89
|
+
*/
|
|
90
|
+
onMessage(sessionId, message) {
|
|
91
|
+
this._onDataDispatcher.dispatch(sessionId, message);
|
|
92
|
+
}
|
|
93
|
+
closeClient(sessionId, data, signal) {
|
|
94
|
+
this.logger.log(`${sessionId} was closed, error:`, data);
|
|
95
|
+
if ((0, common_1.isTerminalError)(data)) {
|
|
96
|
+
this._onError.fire(data);
|
|
97
|
+
}
|
|
98
|
+
else if (typeof data === 'number') {
|
|
99
|
+
// 说明是 pty 报出来的正常退出
|
|
100
|
+
this._onExitDispatcher.dispatch(sessionId, { code: data, signal });
|
|
101
|
+
this._onExit.fire({ sessionId, code: data, signal });
|
|
102
|
+
}
|
|
103
|
+
else if (data) {
|
|
104
|
+
// 说明是 pty 报出来的正常退出
|
|
105
|
+
this._onExitDispatcher.dispatch(sessionId, { code: data.code, signal: data.signal });
|
|
106
|
+
this._onExit.fire({ sessionId, code: data.code, signal: data.signal });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
$processChange(sessionId, processName) {
|
|
110
|
+
this._onProcessChange.fire({ sessionId, processName });
|
|
111
|
+
}
|
|
112
|
+
async getOS() {
|
|
113
|
+
if (this.backendOs) {
|
|
114
|
+
return this.backendOs;
|
|
115
|
+
}
|
|
116
|
+
return (this.backendOs = this.serviceClientRPC.getOS());
|
|
117
|
+
}
|
|
118
|
+
async getProfiles(autoDetect) {
|
|
119
|
+
const platformKey = await this.getCodePlatformKey();
|
|
120
|
+
const terminalPreferences = this.preferenceService.get(`${"terminal.integrated.profiles." /* CodeTerminalSettingPrefix.Profiles */}${platformKey}`, {});
|
|
121
|
+
return await this.serviceClientRPC.detectAvailableProfiles({
|
|
122
|
+
autoDetect,
|
|
123
|
+
preference: terminalPreferences,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
async getCwd(sessionId) {
|
|
127
|
+
try {
|
|
128
|
+
return await this.serviceClientRPC.getCwd(sessionId);
|
|
129
|
+
}
|
|
130
|
+
catch (_a) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async getDefaultSystemShell() {
|
|
135
|
+
return await this.serviceClientRPC.getDefaultSystemShell(await this.getOS());
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
exports.NodePtyTerminalService = NodePtyTerminalService;
|
|
139
|
+
NodePtyTerminalService.countId = 1;
|
|
140
|
+
tslib_1.__decorate([
|
|
141
|
+
(0, di_1.Autowired)(di_1.INJECTOR_TOKEN),
|
|
142
|
+
tslib_1.__metadata("design:type", di_1.Injector)
|
|
143
|
+
], NodePtyTerminalService.prototype, "injector", void 0);
|
|
144
|
+
tslib_1.__decorate([
|
|
145
|
+
(0, di_1.Autowired)(ide_core_common_1.ILogger),
|
|
146
|
+
tslib_1.__metadata("design:type", Object)
|
|
147
|
+
], NodePtyTerminalService.prototype, "logger", void 0);
|
|
148
|
+
tslib_1.__decorate([
|
|
149
|
+
(0, di_1.Autowired)(common_1.ITerminalServicePath),
|
|
150
|
+
tslib_1.__metadata("design:type", Object)
|
|
151
|
+
], NodePtyTerminalService.prototype, "serviceClientRPC", void 0);
|
|
152
|
+
tslib_1.__decorate([
|
|
153
|
+
(0, di_1.Autowired)(ide_core_browser_1.PreferenceService),
|
|
154
|
+
tslib_1.__metadata("design:type", Object)
|
|
155
|
+
], NodePtyTerminalService.prototype, "preferenceService", void 0);
|
|
156
|
+
tslib_1.__decorate([
|
|
157
|
+
(0, di_1.Autowired)(ide_core_common_1.IApplicationService),
|
|
158
|
+
tslib_1.__metadata("design:type", Object)
|
|
159
|
+
], NodePtyTerminalService.prototype, "applicationService", void 0);
|
|
160
|
+
exports.NodePtyTerminalService = NodePtyTerminalService = NodePtyTerminalService_1 = tslib_1.__decorate([
|
|
161
|
+
(0, di_1.Injectable)()
|
|
162
|
+
], NodePtyTerminalService);
|
|
163
|
+
//# sourceMappingURL=terminal.service.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Event } from '@opensumi/ide-core-common';
|
|
2
|
+
import { ITerminalExitEvent, ITerminalTitleChangeEvent } from './client';
|
|
3
|
+
import { ITerminalExternalClient } from './controller';
|
|
4
|
+
import { ITerminalInfo, TerminalOptions } from './pty';
|
|
5
|
+
export declare const ITerminalApiService: unique symbol;
|
|
6
|
+
export interface ITerminalApiService {
|
|
7
|
+
createTerminal(options: TerminalOptions, id?: string): Promise<ITerminalExternalClient>;
|
|
8
|
+
sendText(id: string, text: string, addNewLine?: boolean): void;
|
|
9
|
+
getProcessId(sessionId: string): Promise<number | undefined>;
|
|
10
|
+
getDefaultShellPath(): Promise<string>;
|
|
11
|
+
onDidOpenTerminal: Event<ITerminalInfo>;
|
|
12
|
+
onDidCloseTerminal: Event<ITerminalExitEvent>;
|
|
13
|
+
onDidTerminalTitleChange: Event<ITerminalTitleChangeEvent>;
|
|
14
|
+
onDidChangeActiveTerminal: Event<string>;
|
|
15
|
+
terminals: ITerminalInfo[];
|
|
16
|
+
showTerm(id: string, preserveFocus?: boolean): void;
|
|
17
|
+
hideTerm(id: string): void;
|
|
18
|
+
removeTerm(id: string): void;
|
|
19
|
+
createWidget(uniqName: string, widgetRenderFunc: (element: HTMLDivElement) => void): void;
|
|
20
|
+
scheduleReconnection(): void;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/common/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAEvD,eAAO,MAAM,mBAAmB,eAAgC,CAAC;AACjE,MAAM,WAAW,mBAAmB;IAClC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACxF,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/D,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7D,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC,iBAAiB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IACxC,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAC9C,wBAAwB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC3D,yBAAyB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzC,SAAS,EAAE,aAAa,EAAE,CAAC;IAE3B,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI,CAAC;IAE1F,oBAAoB,IAAI,IAAI,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/common/api.ts"],"names":[],"mappings":";;;AAMa,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { ISearchOptions } from '@xterm/addon-search';
|
|
2
|
+
import { IEvent, Terminal } from '@xterm/xterm';
|
|
3
|
+
import { Deferred, Disposable, Event, IDisposable } from '@opensumi/ide-core-common';
|
|
4
|
+
import { ICreateTerminalOptions, INodePtyInstance, IShellLaunchConfig, TerminalOptions } from './pty';
|
|
5
|
+
import { IWidget } from './resize';
|
|
6
|
+
export interface ITerminalDataEvent {
|
|
7
|
+
id: string;
|
|
8
|
+
data: string | ArrayBuffer;
|
|
9
|
+
}
|
|
10
|
+
export interface ITerminalExitEvent {
|
|
11
|
+
id: string;
|
|
12
|
+
code?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ITerminalTitleChangeEvent {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ITerminalClient extends Disposable {
|
|
19
|
+
/**
|
|
20
|
+
* 标识终端客户端的唯一 id。
|
|
21
|
+
* 长 id,由 clientId + "|" + shortId 组成
|
|
22
|
+
*/
|
|
23
|
+
id: string;
|
|
24
|
+
/**
|
|
25
|
+
* 终端客户端对应的后端进程 id
|
|
26
|
+
*/
|
|
27
|
+
pid: Promise<number | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* 终端客户端对应的名称,可能是用户自定义,也可能来自后端
|
|
30
|
+
*/
|
|
31
|
+
name: string;
|
|
32
|
+
launchConfig: IShellLaunchConfig;
|
|
33
|
+
/**
|
|
34
|
+
* 终端客户端渲染所使用的上层 dom 节点
|
|
35
|
+
*/
|
|
36
|
+
container: HTMLDivElement;
|
|
37
|
+
/**
|
|
38
|
+
* 终端已就绪
|
|
39
|
+
*/
|
|
40
|
+
ready: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 终端客户端是否和后端相连接
|
|
43
|
+
*/
|
|
44
|
+
attached: Deferred<void>;
|
|
45
|
+
/**
|
|
46
|
+
* 首次消息输出
|
|
47
|
+
*/
|
|
48
|
+
firstOutput: Deferred<void>;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
show: Deferred<void> | null;
|
|
53
|
+
/**
|
|
54
|
+
* Xterm 实例
|
|
55
|
+
*/
|
|
56
|
+
term: Terminal;
|
|
57
|
+
/**
|
|
58
|
+
* 渲染窗口
|
|
59
|
+
*/
|
|
60
|
+
widget: IWidget;
|
|
61
|
+
/**
|
|
62
|
+
* 是否作为 TaskExecutor
|
|
63
|
+
*/
|
|
64
|
+
isTaskExecutor?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* 作为 TaskExecutor 时对应的 taskId
|
|
67
|
+
*/
|
|
68
|
+
taskId?: string;
|
|
69
|
+
/**
|
|
70
|
+
* 终端客户端获取输入焦点
|
|
71
|
+
*/
|
|
72
|
+
focus(): void;
|
|
73
|
+
/**
|
|
74
|
+
* 清除内容
|
|
75
|
+
*/
|
|
76
|
+
clear(): void;
|
|
77
|
+
/**
|
|
78
|
+
* 重置
|
|
79
|
+
*/
|
|
80
|
+
reset(): void;
|
|
81
|
+
/**
|
|
82
|
+
* 全选内容
|
|
83
|
+
*/
|
|
84
|
+
selectAll(): void;
|
|
85
|
+
/**
|
|
86
|
+
* 获取选择的内容
|
|
87
|
+
*/
|
|
88
|
+
getSelection(): string;
|
|
89
|
+
/**
|
|
90
|
+
* 粘贴文本
|
|
91
|
+
* @param text
|
|
92
|
+
*/
|
|
93
|
+
paste(text: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* 向下查找字符串
|
|
96
|
+
*
|
|
97
|
+
* @param text 用户输入的字符串
|
|
98
|
+
*/
|
|
99
|
+
findNext(text: string, searchOptions?: ISearchOptions): void;
|
|
100
|
+
findPrevious(text: string, searchOptions?: ISearchOptions): void;
|
|
101
|
+
onSearchResultsChange: IEvent<{
|
|
102
|
+
resultIndex: number;
|
|
103
|
+
resultCount: number;
|
|
104
|
+
}>;
|
|
105
|
+
closeSearch(): void;
|
|
106
|
+
/**
|
|
107
|
+
* 向后端发送一段字符串
|
|
108
|
+
*
|
|
109
|
+
* @param message 发送的字符串消息
|
|
110
|
+
*/
|
|
111
|
+
sendText(message: string): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* 更新终端客户端渲染主题
|
|
114
|
+
*/
|
|
115
|
+
updateTheme(): void;
|
|
116
|
+
/**
|
|
117
|
+
* 更新终端客户端配置
|
|
118
|
+
* @deprecated 请使用 IShellLaunchConfig
|
|
119
|
+
*/
|
|
120
|
+
updateTerminalName(options: TerminalOptions): void;
|
|
121
|
+
/**
|
|
122
|
+
* 更新终端客户端配置
|
|
123
|
+
*/
|
|
124
|
+
updateLaunchConfig(launchConfig: IShellLaunchConfig): void;
|
|
125
|
+
/**
|
|
126
|
+
* 检查终端的健康状态,Shell 进程是否存活
|
|
127
|
+
*/
|
|
128
|
+
checkHealthy(): Promise<boolean>;
|
|
129
|
+
/**
|
|
130
|
+
* 在终端不健康时(对应的Shell 进程被 Kill),使用 Xterm 提示用户,避免误解
|
|
131
|
+
*/
|
|
132
|
+
displayUnHealthyMessage(): void;
|
|
133
|
+
/**
|
|
134
|
+
* clear 参数用于判断是否需要清理 meta 信息,
|
|
135
|
+
* 不需要 clear 参数的时候基本为正常推出,
|
|
136
|
+
* 异常的时候需要将 clear 设为 false,保留现场
|
|
137
|
+
*
|
|
138
|
+
* @param clear
|
|
139
|
+
*/
|
|
140
|
+
dispose(clear?: boolean): void;
|
|
141
|
+
/**
|
|
142
|
+
* stdout 输出事件
|
|
143
|
+
*/
|
|
144
|
+
onOutput: Event<ITerminalDataEvent>;
|
|
145
|
+
/**
|
|
146
|
+
* stdin 输入事件
|
|
147
|
+
*/
|
|
148
|
+
onInput: Event<ITerminalDataEvent>;
|
|
149
|
+
/**
|
|
150
|
+
* 退出事件
|
|
151
|
+
*/
|
|
152
|
+
onExit: Event<ITerminalExitEvent>;
|
|
153
|
+
/**
|
|
154
|
+
* 标题变更事件
|
|
155
|
+
*/
|
|
156
|
+
onTitleChange: Event<ITerminalTitleChangeEvent>;
|
|
157
|
+
/**
|
|
158
|
+
* linkManager 初始化成功事件
|
|
159
|
+
*/
|
|
160
|
+
onLinksReady: Event<ITerminalClient>;
|
|
161
|
+
areLinksReady: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* 注册 LinkProvider
|
|
164
|
+
*/
|
|
165
|
+
registerLinkProvider(provider: ITerminalExternalLinkProvider): IDisposable;
|
|
166
|
+
}
|
|
167
|
+
export declare const ITerminalClientFactory2: unique symbol;
|
|
168
|
+
export type ITerminalClientFactory2 = (widget: IWidget, options?: ICreateTerminalOptions, disposable?: IDisposable) => Promise<ITerminalClient>;
|
|
169
|
+
export interface ITerminalConnection {
|
|
170
|
+
name: string;
|
|
171
|
+
readonly: boolean;
|
|
172
|
+
sendData(data: string | ArrayBuffer): void;
|
|
173
|
+
onData: Event<string | ArrayBuffer>;
|
|
174
|
+
onExit?: Event<number | undefined>;
|
|
175
|
+
ptyInstance?: INodePtyInstance;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Similar to xterm.js' ILinkProvider but using promises and hides xterm.js internals (like buffer
|
|
179
|
+
* positions, decorations, etc.) from the rest of vscode. This is the interface to use for
|
|
180
|
+
* workbench integrations.
|
|
181
|
+
*/
|
|
182
|
+
export interface ITerminalExternalLinkProvider {
|
|
183
|
+
provideLinks(instance: ITerminalClient, line: string): Promise<ITerminalLink[] | undefined>;
|
|
184
|
+
}
|
|
185
|
+
export interface ITerminalLink {
|
|
186
|
+
/** The startIndex of the link in the line. */
|
|
187
|
+
startIndex: number;
|
|
188
|
+
/** The length of the link in the line. */
|
|
189
|
+
length: number;
|
|
190
|
+
/** The descriptive label for what the link does when activated. */
|
|
191
|
+
label?: string;
|
|
192
|
+
/**
|
|
193
|
+
* Activates the link.
|
|
194
|
+
* @param text The text of the link.
|
|
195
|
+
*/
|
|
196
|
+
activate(text: string): void;
|
|
197
|
+
}
|
|
198
|
+
export declare const TERMINAL_ID_SEPARATOR = "|";
|
|
199
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAErF,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,GAAG,EAAE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAEjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb,YAAY,EAAE,kBAAkB,CAAC;IACjC;;OAEG;IACH,SAAS,EAAE,cAAc,CAAC;IAE1B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzB;;OAEG;IACH,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,KAAK,IAAI,IAAI,CAAC;IAEd;;OAEG;IACH,SAAS,IAAI,IAAI,CAAC;IAClB;;OAEG;IACH,YAAY,IAAI,MAAM,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAE7D,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAEjE,qBAAqB,EAAE,MAAM,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAE5E,WAAW,IAAI,IAAI,CAAC;IAEpB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzC;;OAEG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;;OAGG;IACH,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IACnD;;OAEG;IACH,kBAAkB,CAAC,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAE3D;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEjC;;OAEG;IACH,uBAAuB,IAAI,IAAI,CAAC;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEpC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEnC;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAElC;;OAEG;IACH,aAAa,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAEhD;;OAEG;IACH,YAAY,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAErC,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,oBAAoB,CAAC,QAAQ,EAAE,6BAA6B,GAAG,WAAW,CAAC;CAC5E;AAED,eAAO,MAAM,uBAAuB,eAAoC,CAAC;AACzE,MAAM,MAAM,uBAAuB,GAAG,CACpC,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,sBAAsB,EAChC,UAAU,CAAC,EAAE,WAAW,KACrB,OAAO,CAAC,eAAe,CAAC,CAAC;AAE9B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;IAC3C,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,GAAG,SAAS,CAAC,CAAC;CAC7F;AAED,MAAM,WAAW,aAAa;IAC5B,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,qBAAqB,MAAM,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TERMINAL_ID_SEPARATOR = exports.ITerminalClientFactory2 = void 0;
|
|
4
|
+
exports.ITerminalClientFactory2 = Symbol('ITerminalClientFactory2');
|
|
5
|
+
exports.TERMINAL_ID_SEPARATOR = '|';
|
|
6
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/common/client.ts"],"names":[],"mappings":";;;AAwMa,QAAA,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAuC5D,QAAA,qBAAqB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { IEvent } from '@xterm/xterm';
|
|
2
|
+
import { IContextKeyService } from '@opensumi/ide-core-browser';
|
|
3
|
+
import { Deferred, Disposable, Event, IDisposable, Uri } from '@opensumi/ide-core-common';
|
|
4
|
+
import { IObservable } from '@opensumi/ide-monaco/lib/common/observable';
|
|
5
|
+
import { ITerminalClient, ITerminalExitEvent, ITerminalExternalLinkProvider, ITerminalTitleChangeEvent } from './client';
|
|
6
|
+
import { IStartExtensionTerminalRequest, ITerminalLaunchError, ITerminalProcessExtHostProxy } from './extension';
|
|
7
|
+
import { ITerminalProfile } from './profile';
|
|
8
|
+
import { ICreateTerminalOptions, IShellLaunchConfig, ITerminalInfo, TerminalOptions } from './pty';
|
|
9
|
+
import { IWidget, IWidgetGroup } from './resize';
|
|
10
|
+
import type { ILinkHoverTargetOptions } from '../browser/links/link-manager';
|
|
11
|
+
export interface ITerminalExternalClient {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly processId: Promise<number | undefined>;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
show(preserveFocus?: boolean): void;
|
|
16
|
+
hide(): void;
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
19
|
+
export interface IBoundSize {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ICreateClientWithWidgetOptions {
|
|
24
|
+
terminalOptions: TerminalOptions;
|
|
25
|
+
/**
|
|
26
|
+
* 插件进程传递的唯一 ID
|
|
27
|
+
*/
|
|
28
|
+
id?: string;
|
|
29
|
+
/**
|
|
30
|
+
* pty 进程退出后是否自动关闭 terminal 控件
|
|
31
|
+
*/
|
|
32
|
+
closeWhenExited?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 是否为 TaskExecutor
|
|
35
|
+
*/
|
|
36
|
+
isTaskExecutor?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 作为 TaskExecutor 时对应的 taskId
|
|
39
|
+
*/
|
|
40
|
+
taskId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 自定义的参数,由上层集成方自行控制
|
|
43
|
+
*/
|
|
44
|
+
args?: any;
|
|
45
|
+
beforeCreate?: (terminalId: string) => void;
|
|
46
|
+
}
|
|
47
|
+
export interface TerminalCliterFilter {
|
|
48
|
+
id?: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
isTaskExecutor?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export declare const ITerminalController: unique symbol;
|
|
53
|
+
export interface ITerminalController extends Disposable {
|
|
54
|
+
ready: Deferred<void>;
|
|
55
|
+
focused: boolean;
|
|
56
|
+
clients: Map<string, ITerminalClient>;
|
|
57
|
+
activeClient?: ITerminalClient;
|
|
58
|
+
themeBackground: string;
|
|
59
|
+
contextKeyService?: IContextKeyService;
|
|
60
|
+
viewReady: Deferred<void>;
|
|
61
|
+
disposeTerminalClients(filter?: TerminalCliterFilter): void;
|
|
62
|
+
initContextKey(dom: HTMLDivElement): void;
|
|
63
|
+
firstInitialize(): void;
|
|
64
|
+
recovery(history: ITerminalBrowserHistory): Promise<void>;
|
|
65
|
+
reconnect(): Promise<void>;
|
|
66
|
+
focus(): void;
|
|
67
|
+
blur(): void;
|
|
68
|
+
onContextMenu(e: React.MouseEvent<HTMLElement>): void;
|
|
69
|
+
findClientFromWidgetId(widgetId: string): ITerminalClient | undefined;
|
|
70
|
+
createTerminalWithWidgetByTerminalOptions(options: ICreateClientWithWidgetOptions): Promise<ITerminalClient>;
|
|
71
|
+
createTerminal(options: ICreateTerminalOptions): Promise<ITerminalClient>;
|
|
72
|
+
createTerminalWithWidget(options: ICreateTerminalOptions): Promise<ITerminalClient>;
|
|
73
|
+
clearCurrentGroup(): void;
|
|
74
|
+
clearAllGroups(): void;
|
|
75
|
+
showTerminalPanel(): void;
|
|
76
|
+
hideTerminalPanel(): void;
|
|
77
|
+
toggleTerminalPanel(): void;
|
|
78
|
+
toJSON(): ITerminalBrowserHistory;
|
|
79
|
+
convertTerminalOptionsToLaunchConfig(options: TerminalOptions): IShellLaunchConfig;
|
|
80
|
+
convertProfileToLaunchConfig(shellLaunchConfigOrProfile: IShellLaunchConfig | ITerminalProfile | undefined, cwd?: Uri | string): IShellLaunchConfig;
|
|
81
|
+
onDidOpenTerminal: Event<ITerminalInfo>;
|
|
82
|
+
onDidCloseTerminal: Event<ITerminalExitEvent>;
|
|
83
|
+
onDidTerminalTitleChange: Event<ITerminalTitleChangeEvent>;
|
|
84
|
+
onDidChangeActiveTerminal: Event<string>;
|
|
85
|
+
onThemeBackgroundChange: Event<string>;
|
|
86
|
+
requestStartExtensionTerminal(proxy: ITerminalProcessExtHostProxy, cols: number, rows: number): Promise<ITerminalLaunchError | undefined>;
|
|
87
|
+
readonly onInstanceRequestStartExtensionTerminal: Event<IStartExtensionTerminalRequest>;
|
|
88
|
+
registerLinkProvider(provider: ITerminalExternalLinkProvider): IDisposable;
|
|
89
|
+
}
|
|
90
|
+
export interface IUIState {
|
|
91
|
+
isMatchCase: boolean;
|
|
92
|
+
isWholeWord: boolean;
|
|
93
|
+
isUseRegexp: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface ISearchResult {
|
|
96
|
+
resultCount: number;
|
|
97
|
+
resultIndex: number;
|
|
98
|
+
}
|
|
99
|
+
export declare const ITerminalSearchService: unique symbol;
|
|
100
|
+
export interface ITerminalSearchService {
|
|
101
|
+
isVisible: boolean;
|
|
102
|
+
onVisibleChange: Event<boolean>;
|
|
103
|
+
UIState: IUIState;
|
|
104
|
+
onResultChange: IEvent<ISearchResult> | undefined;
|
|
105
|
+
text: string;
|
|
106
|
+
open(): void;
|
|
107
|
+
clear(): void;
|
|
108
|
+
close(): void;
|
|
109
|
+
search(): void;
|
|
110
|
+
searchNext(): void;
|
|
111
|
+
searchPrevious(): void;
|
|
112
|
+
updateUIState(state: Partial<IUIState>): void;
|
|
113
|
+
}
|
|
114
|
+
export declare const ITerminalGroupViewService: unique symbol;
|
|
115
|
+
export interface ITerminalGroupViewService {
|
|
116
|
+
readonly groups: IObservable<IWidgetGroup[]>;
|
|
117
|
+
readonly currentGroupIndex: IObservable<number>;
|
|
118
|
+
readonly currentGroup: IObservable<IWidgetGroup>;
|
|
119
|
+
readonly currentGroupId: IObservable<string>;
|
|
120
|
+
readonly currentWidgetId: IObservable<string>;
|
|
121
|
+
readonly currentWidget: IObservable<IWidget>;
|
|
122
|
+
createGroup(): number;
|
|
123
|
+
getGroup(index: number): IWidgetGroup;
|
|
124
|
+
selectGroup(index: number): void;
|
|
125
|
+
removeGroup(index: number): void;
|
|
126
|
+
swapGroup(i: number, j: number): void;
|
|
127
|
+
createWidget(group: IWidgetGroup, id?: string, reuse?: boolean, isSimpleWidget?: boolean): IWidget;
|
|
128
|
+
getWidget(id: string): IWidget;
|
|
129
|
+
selectWidget(widgetId: string): void;
|
|
130
|
+
removeWidget(id: string): void;
|
|
131
|
+
onWidgetCreated: Event<IWidget>;
|
|
132
|
+
onWidgetSelected: Event<IWidget>;
|
|
133
|
+
onWidgetDisposed: Event<IWidget>;
|
|
134
|
+
onWidgetEmpty: Event<void>;
|
|
135
|
+
empty(): boolean;
|
|
136
|
+
clear(): void;
|
|
137
|
+
}
|
|
138
|
+
export interface ITerminalBrowserHistory {
|
|
139
|
+
current: string | undefined;
|
|
140
|
+
groups: {
|
|
141
|
+
client: string;
|
|
142
|
+
task?: string;
|
|
143
|
+
}[][];
|
|
144
|
+
}
|
|
145
|
+
export declare const ITerminalHoverManagerService: unique symbol;
|
|
146
|
+
export interface ITerminalHoverManagerService extends IDisposable {
|
|
147
|
+
showHover(targetOptions: ILinkHoverTargetOptions, text: string, linkHandler: (url: string) => void): IDisposable;
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=controller.d.ts.map
|