@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,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TerminalNetworkService = 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 TerminalNetworkService = class TerminalNetworkService extends ide_core_common_1.Disposable {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this._onConnect = new ide_core_common_1.Emitter();
|
|
12
|
+
this.onConnect = this._onConnect.event;
|
|
13
|
+
this._onDisconnect = new ide_core_common_1.Emitter();
|
|
14
|
+
this.onDisconnect = this._onDisconnect.event;
|
|
15
|
+
this._status = common_1.TerminalNetworkStatus.DISCONNECTED;
|
|
16
|
+
this._resetRetryTimers = new Map();
|
|
17
|
+
this._reconnectInfo = new Map();
|
|
18
|
+
this.controller.onDidCloseTerminal((e) => {
|
|
19
|
+
this._resetRetryTimers.delete(e.id);
|
|
20
|
+
this._reconnectInfo.delete(e.id);
|
|
21
|
+
});
|
|
22
|
+
this.onDispose(() => {
|
|
23
|
+
if (this._timer) {
|
|
24
|
+
clearTimeout(this._timer);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
get status() {
|
|
29
|
+
return this._status;
|
|
30
|
+
}
|
|
31
|
+
setStatus(status) {
|
|
32
|
+
this._status = status;
|
|
33
|
+
if (status === common_1.TerminalNetworkStatus.CONNECTED) {
|
|
34
|
+
this._onConnect.fire();
|
|
35
|
+
this.scheduleReconnection();
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
this._onDisconnect.fire();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
bindErrors() {
|
|
42
|
+
this.service.onError(this.handleError.bind(this));
|
|
43
|
+
}
|
|
44
|
+
handleError(error) {
|
|
45
|
+
if (error.shouldReconnect == null) {
|
|
46
|
+
error.shouldReconnect = true;
|
|
47
|
+
}
|
|
48
|
+
const sessionId = error.id;
|
|
49
|
+
const reconnectInfo = this.getReconnectInfo(sessionId);
|
|
50
|
+
if (reconnectInfo.times) {
|
|
51
|
+
reconnectInfo.nextRetry = Date.now() + 2000;
|
|
52
|
+
}
|
|
53
|
+
this._reconnectInfo.set(sessionId, reconnectInfo);
|
|
54
|
+
this.scheduleReconnection();
|
|
55
|
+
}
|
|
56
|
+
reconnect() {
|
|
57
|
+
if (this._status === common_1.TerminalNetworkStatus.DISCONNECTED) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const now = Date.now();
|
|
61
|
+
let delay = Number.POSITIVE_INFINITY;
|
|
62
|
+
for (const sessionId of this.errorService.errors.keys()) {
|
|
63
|
+
if (!this.shouldReconnect(sessionId)) {
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
const { nextRetry } = this.getReconnectInfo(sessionId);
|
|
67
|
+
if (nextRetry > now) {
|
|
68
|
+
delay = Math.min(delay, nextRetry - now);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
this.reconnectClient(sessionId);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// 存在需要延迟重试的终端
|
|
75
|
+
if (delay < Number.POSITIVE_INFINITY) {
|
|
76
|
+
this.scheduleReconnection(delay);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async reconnectClient(sessionId) {
|
|
80
|
+
this.countRetry(sessionId);
|
|
81
|
+
const reconnected = this.errorService.fix(sessionId);
|
|
82
|
+
reconnected.then(() => {
|
|
83
|
+
this.resetRetryLater(sessionId);
|
|
84
|
+
});
|
|
85
|
+
return reconnected;
|
|
86
|
+
}
|
|
87
|
+
getReconnectInfo(sessionId) {
|
|
88
|
+
const reconnectInfo = this._reconnectInfo.get(sessionId);
|
|
89
|
+
return (reconnectInfo || {
|
|
90
|
+
times: 0,
|
|
91
|
+
nextRetry: 0,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
countRetry(sessionId) {
|
|
95
|
+
const timer = this._resetRetryTimers.get(sessionId);
|
|
96
|
+
if (timer) {
|
|
97
|
+
clearTimeout(timer);
|
|
98
|
+
this._resetRetryTimers.delete(sessionId);
|
|
99
|
+
}
|
|
100
|
+
const reconnectInfo = this.getReconnectInfo(sessionId);
|
|
101
|
+
reconnectInfo.times += 1;
|
|
102
|
+
this._reconnectInfo.set(sessionId, reconnectInfo);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 连接成功后重置重连计数
|
|
106
|
+
* 这里延迟的作用是避免网络不稳定时频繁断连导致计数重置
|
|
107
|
+
*/
|
|
108
|
+
resetRetryLater(sessionId) {
|
|
109
|
+
const timer = window.setTimeout(() => {
|
|
110
|
+
this._reconnectInfo.delete(sessionId);
|
|
111
|
+
this._resetRetryTimers.delete(sessionId);
|
|
112
|
+
}, 8000);
|
|
113
|
+
this._resetRetryTimers.set(sessionId, timer);
|
|
114
|
+
}
|
|
115
|
+
scheduleReconnection(delay = 200) {
|
|
116
|
+
if (this._timer) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
this._timer = window.setTimeout(() => {
|
|
120
|
+
this._timer = undefined;
|
|
121
|
+
this.reconnect();
|
|
122
|
+
}, delay);
|
|
123
|
+
}
|
|
124
|
+
shouldReconnect(sessionId) {
|
|
125
|
+
const error = this.errorService.errors.get(sessionId);
|
|
126
|
+
if (!(error === null || error === void 0 ? void 0 : error.shouldReconnect)) {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
const retried = this.getReconnectInfo(sessionId).times;
|
|
130
|
+
return retried < 3;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
exports.TerminalNetworkService = TerminalNetworkService;
|
|
134
|
+
tslib_1.__decorate([
|
|
135
|
+
(0, di_1.Autowired)(common_1.ITerminalErrorService),
|
|
136
|
+
tslib_1.__metadata("design:type", Object)
|
|
137
|
+
], TerminalNetworkService.prototype, "errorService", void 0);
|
|
138
|
+
tslib_1.__decorate([
|
|
139
|
+
(0, di_1.Autowired)(common_1.ITerminalInternalService),
|
|
140
|
+
tslib_1.__metadata("design:type", Object)
|
|
141
|
+
], TerminalNetworkService.prototype, "service", void 0);
|
|
142
|
+
tslib_1.__decorate([
|
|
143
|
+
(0, di_1.Autowired)(common_1.ITerminalController),
|
|
144
|
+
tslib_1.__metadata("design:type", Object)
|
|
145
|
+
], TerminalNetworkService.prototype, "controller", void 0);
|
|
146
|
+
exports.TerminalNetworkService = TerminalNetworkService = tslib_1.__decorate([
|
|
147
|
+
(0, di_1.Injectable)(),
|
|
148
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
149
|
+
], TerminalNetworkService);
|
|
150
|
+
//# sourceMappingURL=terminal.network.js.map
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var TerminalPreference_1;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.TerminalPreference = void 0;
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const pickBy_1 = tslib_1.__importDefault(require("lodash/pickBy"));
|
|
7
|
+
const di_1 = require("@opensumi/di");
|
|
8
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
9
|
+
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
10
|
+
const preference_1 = require("../common/preference");
|
|
11
|
+
let TerminalPreference = TerminalPreference_1 = class TerminalPreference {
|
|
12
|
+
_prefToOption(pref) {
|
|
13
|
+
if (pref.startsWith('terminal.integrated.')) {
|
|
14
|
+
return pref.replace('terminal.integrated.', '');
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return pref.replace('terminal.', '');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
_optionToPref(option) {
|
|
21
|
+
return `terminal.${option}`;
|
|
22
|
+
}
|
|
23
|
+
_valid(option, value) {
|
|
24
|
+
return this.toValidOption(option, value) || TerminalPreference_1.defaultOptions[option];
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
this._onChange = new ide_core_common_1.Emitter();
|
|
28
|
+
this.onChange = this._onChange.event;
|
|
29
|
+
this.service.onPreferenceChanged(({ preferenceName, newValue, oldValue }) => {
|
|
30
|
+
const name = this._prefToOption(preferenceName);
|
|
31
|
+
if (newValue === oldValue) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (preference_1.SupportedOptionsName[name]) {
|
|
35
|
+
this._onChange.fire({
|
|
36
|
+
name,
|
|
37
|
+
value: this._valid(name, newValue),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
getCodeCompatibleOption() {
|
|
43
|
+
const options = {
|
|
44
|
+
copyOnSelection: this.service.get("terminal.integrated.copyOnSelection" /* CodeTerminalSettingId.CopyOnSelection */),
|
|
45
|
+
cursorBlink: this.service.get("terminal.integrated.cursorBlinking" /* CodeTerminalSettingId.CursorBlinking */),
|
|
46
|
+
fontSize: this.service.get("terminal.integrated.fontSize" /* CodeTerminalSettingId.FontSize */),
|
|
47
|
+
scrollback: this.service.get("terminal.integrated.scrollback" /* CodeTerminalSettingId.Scrollback */),
|
|
48
|
+
fontFamily: this.service.get("terminal.integrated.fontFamily" /* CodeTerminalSettingId.FontFamily */) || this.service.get('editor.fontFamily'),
|
|
49
|
+
fontWeight: this.service.get("terminal.integrated.fontWeight" /* CodeTerminalSettingId.FontWeight */),
|
|
50
|
+
fontWeightBold: this.service.get("terminal.integrated.fontWeightBold" /* CodeTerminalSettingId.FontWeightBold */),
|
|
51
|
+
cursorStyle: this.service.get("terminal.integrated.cursorStyle" /* CodeTerminalSettingId.CursorStyle */) === 'line'
|
|
52
|
+
? 'bar'
|
|
53
|
+
: this.service.get("terminal.integrated.cursorStyle" /* CodeTerminalSettingId.CursorStyle */),
|
|
54
|
+
cursorWidth: this.service.get("terminal.integrated.cursorWidth" /* CodeTerminalSettingId.CursorWidth */),
|
|
55
|
+
lineHeight: this.service.get("terminal.integrated.lineHeight" /* CodeTerminalSettingId.LineHeight */),
|
|
56
|
+
letterSpacing: this.service.get("terminal.integrated.letterSpacing" /* CodeTerminalSettingId.LetterSpacing */),
|
|
57
|
+
fastScrollSensitivity: this.service.get("terminal.integrated.fastScrollSensitivity" /* CodeTerminalSettingId.FastScrollSensitivity */),
|
|
58
|
+
};
|
|
59
|
+
return (0, pickBy_1.default)(options, (val) => val !== undefined);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @param option 终端的 option 选项名
|
|
63
|
+
*/
|
|
64
|
+
get(option) {
|
|
65
|
+
const val = this.service.get(this._optionToPref(option), TerminalPreference_1.defaultOptions[option]);
|
|
66
|
+
return this._valid(option, val);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @param option 终端的 option 选项名
|
|
70
|
+
*/
|
|
71
|
+
getOrUndefined(option) {
|
|
72
|
+
const val = this.service.get(this._optionToPref(option));
|
|
73
|
+
return val;
|
|
74
|
+
}
|
|
75
|
+
toValidOption(option, value) {
|
|
76
|
+
switch (option) {
|
|
77
|
+
case preference_1.SupportedOptionsName.fontSize:
|
|
78
|
+
return value > 5 ? value : 5;
|
|
79
|
+
case preference_1.SupportedOptionsName.cursorStyle:
|
|
80
|
+
return value === 'line' ? 'bar' : value;
|
|
81
|
+
default:
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 遍历所有支持项,用户没有设置该项则返回空
|
|
87
|
+
*/
|
|
88
|
+
getOptions() {
|
|
89
|
+
const options = {};
|
|
90
|
+
Object.entries(preference_1.SupportedOptionsName).forEach(([name]) => {
|
|
91
|
+
if (!name) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const val = this.getOrUndefined(name);
|
|
95
|
+
if (val) {
|
|
96
|
+
options[name] = val;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return options;
|
|
100
|
+
}
|
|
101
|
+
toJSON() {
|
|
102
|
+
return {
|
|
103
|
+
...TerminalPreference_1.defaultOptions,
|
|
104
|
+
...this.getCodeCompatibleOption(),
|
|
105
|
+
...this.getOptions(),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
exports.TerminalPreference = TerminalPreference;
|
|
110
|
+
TerminalPreference.defaultOptions = {
|
|
111
|
+
allowTransparency: false,
|
|
112
|
+
macOptionIsMeta: false,
|
|
113
|
+
cursorBlink: false,
|
|
114
|
+
scrollback: 2500,
|
|
115
|
+
tabStopWidth: 8,
|
|
116
|
+
fontSize: 12,
|
|
117
|
+
customGlyphs: true,
|
|
118
|
+
drawBoldTextInBrightColors: true,
|
|
119
|
+
fastScrollModifier: 'alt',
|
|
120
|
+
fastScrollSensitivity: 5,
|
|
121
|
+
scrollSensitivity: 1,
|
|
122
|
+
overviewRulerWidth: 10,
|
|
123
|
+
copyOnSelection: false,
|
|
124
|
+
fontWeightBold: 'bold',
|
|
125
|
+
fontFamily: "Menlo, Monaco, 'Courier New', monospace",
|
|
126
|
+
cursorStyle: 'block',
|
|
127
|
+
};
|
|
128
|
+
tslib_1.__decorate([
|
|
129
|
+
(0, di_1.Autowired)(ide_core_browser_1.PreferenceService),
|
|
130
|
+
tslib_1.__metadata("design:type", Object)
|
|
131
|
+
], TerminalPreference.prototype, "service", void 0);
|
|
132
|
+
exports.TerminalPreference = TerminalPreference = TerminalPreference_1 = tslib_1.__decorate([
|
|
133
|
+
(0, di_1.Injectable)(),
|
|
134
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
135
|
+
], TerminalPreference);
|
|
136
|
+
//# sourceMappingURL=terminal.preference.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TerminalProfileService 是管理 terminal profiles 的基础类
|
|
4
|
+
* 但我们要在这个 Service 上做一些封装,比如解析 terminal.type 等来制造一个假的 Profile
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.TerminalProfileInternalService = void 0;
|
|
8
|
+
const tslib_1 = require("tslib");
|
|
9
|
+
const di_1 = require("@opensumi/di");
|
|
10
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
11
|
+
const common_1 = require("../common");
|
|
12
|
+
const generatedProfileName = 'Generated Profile';
|
|
13
|
+
let TerminalProfileInternalService = class TerminalProfileInternalService {
|
|
14
|
+
async resolveTerminalTypeProfile() {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
const shellType = this.preferenceService.get("terminal.type" /* TerminalSettingsId.Type */);
|
|
17
|
+
if (!shellType || shellType === 'default') {
|
|
18
|
+
// 继续走我们的 resolveDefaultProfile
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
let shellPath = shellType;
|
|
22
|
+
const args = [];
|
|
23
|
+
const platformKey = await this.terminalService.getCodePlatformKey();
|
|
24
|
+
const terminalOs = await this.terminalService.getOS();
|
|
25
|
+
if (terminalOs === ide_core_browser_1.OperatingSystem.Windows) {
|
|
26
|
+
shellPath = (_a = (await this.serviceClientRPC.$resolveWindowsShellPath(shellType))) !== null && _a !== void 0 ? _a : shellPath;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
shellPath = (_b = (await this.serviceClientRPC.$resolveUnixShellPath(shellType))) !== null && _b !== void 0 ? _b : shellPath;
|
|
30
|
+
}
|
|
31
|
+
const platformSpecificArgs = this.preferenceService.get(`${"terminal.integrated.shellArgs." /* CodeTerminalSettingPrefix.ShellArgs */}${platformKey}`, []);
|
|
32
|
+
args.push(...platformSpecificArgs);
|
|
33
|
+
return {
|
|
34
|
+
profileName: 'terminal.type',
|
|
35
|
+
path: shellPath,
|
|
36
|
+
args,
|
|
37
|
+
icon: undefined,
|
|
38
|
+
isDefault: false,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
async resolveDefaultProfile(options) {
|
|
42
|
+
// 兼容之前的 terminal.type
|
|
43
|
+
const _defaultPorfile = await this.resolveTerminalTypeProfile();
|
|
44
|
+
if (_defaultPorfile) {
|
|
45
|
+
return _defaultPorfile;
|
|
46
|
+
}
|
|
47
|
+
await this.profileService.profilesReady;
|
|
48
|
+
let profile = await this.resolveRealDefaultProfile();
|
|
49
|
+
if (!profile) {
|
|
50
|
+
profile = await this._resolvedFallbackDefaultProfile(options);
|
|
51
|
+
}
|
|
52
|
+
return profile;
|
|
53
|
+
}
|
|
54
|
+
async resolveRealDefaultProfile() {
|
|
55
|
+
await this.profileService.profilesReady;
|
|
56
|
+
const defaultProfileName = this.profileService.getDefaultProfileName();
|
|
57
|
+
if (!defaultProfileName) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return this.profileService.availableProfiles.find((v) => v.profileName === defaultProfileName);
|
|
61
|
+
}
|
|
62
|
+
async _resolvedFallbackDefaultProfile(options) {
|
|
63
|
+
var _a;
|
|
64
|
+
const executable = await this.terminalService.getDefaultSystemShell();
|
|
65
|
+
// Finally fallback to a generated profile
|
|
66
|
+
let args;
|
|
67
|
+
const os = (_a = options === null || options === void 0 ? void 0 : options.os) !== null && _a !== void 0 ? _a : (await this.terminalService.getOS());
|
|
68
|
+
if (os === ide_core_browser_1.OperatingSystem.Macintosh && ide_core_browser_1.path.parse(executable).name.match(/(zsh|bash)/)) {
|
|
69
|
+
// macOS should launch a login shell by default
|
|
70
|
+
args = ['--login'];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
// Resolve undefined to []
|
|
74
|
+
args = [];
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
profileName: generatedProfileName,
|
|
78
|
+
path: executable,
|
|
79
|
+
args,
|
|
80
|
+
isDefault: false,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
exports.TerminalProfileInternalService = TerminalProfileInternalService;
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, di_1.Autowired)(common_1.ITerminalProfileService),
|
|
87
|
+
tslib_1.__metadata("design:type", Object)
|
|
88
|
+
], TerminalProfileInternalService.prototype, "profileService", void 0);
|
|
89
|
+
tslib_1.__decorate([
|
|
90
|
+
(0, di_1.Autowired)(common_1.ITerminalService),
|
|
91
|
+
tslib_1.__metadata("design:type", Object)
|
|
92
|
+
], TerminalProfileInternalService.prototype, "terminalService", void 0);
|
|
93
|
+
tslib_1.__decorate([
|
|
94
|
+
(0, di_1.Autowired)(ide_core_browser_1.PreferenceService),
|
|
95
|
+
tslib_1.__metadata("design:type", Object)
|
|
96
|
+
], TerminalProfileInternalService.prototype, "preferenceService", void 0);
|
|
97
|
+
tslib_1.__decorate([
|
|
98
|
+
(0, di_1.Autowired)(common_1.ITerminalServicePath),
|
|
99
|
+
tslib_1.__metadata("design:type", Object)
|
|
100
|
+
], TerminalProfileInternalService.prototype, "serviceClientRPC", void 0);
|
|
101
|
+
exports.TerminalProfileInternalService = TerminalProfileInternalService = tslib_1.__decorate([
|
|
102
|
+
(0, di_1.Injectable)()
|
|
103
|
+
], TerminalProfileInternalService);
|
|
104
|
+
//# sourceMappingURL=terminal.profile.internal.js.map
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TerminalProfileService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
7
|
+
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
const { equals } = ide_core_common_1.arrays;
|
|
10
|
+
let TerminalProfileService = class TerminalProfileService extends ide_core_common_1.WithEventBus {
|
|
11
|
+
/**
|
|
12
|
+
* 当用户创建了一个 Profile 时发出的事件
|
|
13
|
+
*/
|
|
14
|
+
get onTerminalProfileResolved() {
|
|
15
|
+
return this.onTerminalProfileResolvedEmitter.event;
|
|
16
|
+
}
|
|
17
|
+
get onDidChangeDefaultShell() {
|
|
18
|
+
return this.onDidChangeDefaultShellEmitter.event;
|
|
19
|
+
}
|
|
20
|
+
get profilesReady() {
|
|
21
|
+
return this._profilesReadyBarrier.wait().then(() => { });
|
|
22
|
+
}
|
|
23
|
+
get onDidChangeAvailableProfiles() {
|
|
24
|
+
return this._onDidChangeAvailableProfiles.event;
|
|
25
|
+
}
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.onTerminalProfileResolvedEmitter = new ide_core_common_1.Emitter();
|
|
29
|
+
this.onDidChangeDefaultShellEmitter = new ide_core_common_1.Emitter();
|
|
30
|
+
this._onDidChangeAvailableProfiles = new ide_core_common_1.Emitter();
|
|
31
|
+
this._profileProviders = new Map();
|
|
32
|
+
this._contributedProfiles = [];
|
|
33
|
+
// #region 外部插件贡献的 Terminal Profiles
|
|
34
|
+
this._rawContributedProfileMap = new Map();
|
|
35
|
+
// Wait up to 5 seconds for profiles to be ready so it's assured that we know the actual
|
|
36
|
+
// default terminal before launching the first terminal. This isn't expected to ever take
|
|
37
|
+
// this long.
|
|
38
|
+
this._profilesReadyBarrier = new ide_core_common_1.AutoOpenBarrier(5000);
|
|
39
|
+
this.refreshAvailableProfiles();
|
|
40
|
+
this.setupPreferenceListener();
|
|
41
|
+
}
|
|
42
|
+
get availableProfiles() {
|
|
43
|
+
return this._availableProfiles || [];
|
|
44
|
+
}
|
|
45
|
+
get contributedProfiles() {
|
|
46
|
+
return this._contributedProfiles || [];
|
|
47
|
+
}
|
|
48
|
+
setupPreferenceListener() {
|
|
49
|
+
this.preferenceService.onPreferenceChanged((event) => {
|
|
50
|
+
if (event.preferenceName === "terminal.type" /* TerminalSettingsId.Type */) {
|
|
51
|
+
/**
|
|
52
|
+
* @todo 因 profile 相关能力未完全实现,因此这里先手动派发一个 change shell 的事件
|
|
53
|
+
* 实现完成后,这里应该调用 this.refreshAvailableProfiles();
|
|
54
|
+
*/
|
|
55
|
+
this.onDidChangeDefaultShellEmitter.fire(event.newValue);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
getDefaultProfileName() {
|
|
60
|
+
return this.preferenceService.get(`${"terminal.integrated.defaultProfile." /* CodeTerminalSettingPrefix.DefaultProfile */}${this.terminalService.getCodePlatformKey()}`);
|
|
61
|
+
}
|
|
62
|
+
refreshAvailableProfiles() {
|
|
63
|
+
this._refreshAvailableProfilesNow();
|
|
64
|
+
}
|
|
65
|
+
getContributedProfileProvider(extensionIdentifier, id) {
|
|
66
|
+
const extMap = this._profileProviders.get(extensionIdentifier);
|
|
67
|
+
return extMap === null || extMap === void 0 ? void 0 : extMap.get(id);
|
|
68
|
+
}
|
|
69
|
+
async createContributedTerminalProfile(extensionIdentifier, id, options) {
|
|
70
|
+
await this.onTerminalProfileResolvedEmitter.fireAndAwait(id);
|
|
71
|
+
const profileProvider = this.getContributedProfileProvider(extensionIdentifier, id);
|
|
72
|
+
if (!profileProvider) {
|
|
73
|
+
this.logger.error(`No terminal profile provider registered for id "${id}"`);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
try {
|
|
77
|
+
await profileProvider.createContributedTerminalProfile(options);
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
this.logger.error('create contributed terminal profile error:', e.message);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
registerTerminalProfileProvider(extensionIdentifier, id, profileProvider) {
|
|
84
|
+
let extMap = this._profileProviders.get(extensionIdentifier);
|
|
85
|
+
if (!extMap) {
|
|
86
|
+
extMap = new Map();
|
|
87
|
+
this._profileProviders.set(extensionIdentifier, extMap);
|
|
88
|
+
}
|
|
89
|
+
extMap.set(id, profileProvider);
|
|
90
|
+
return ide_core_common_1.Disposable.create(() => this._profileProviders.delete(id));
|
|
91
|
+
}
|
|
92
|
+
async _detectProfiles(autoDetect = true) {
|
|
93
|
+
return await this.terminalService.getProfiles(autoDetect);
|
|
94
|
+
}
|
|
95
|
+
async _updateContributedProfiles() {
|
|
96
|
+
const platformKey = await this.terminalService.getCodePlatformKey();
|
|
97
|
+
const excludedContributedProfiles = [];
|
|
98
|
+
const configProfiles = this.preferenceService.get("terminal.integrated.profiles." /* CodeTerminalSettingPrefix.Profiles */ + platformKey, {});
|
|
99
|
+
for (const [profileName, value] of Object.entries(configProfiles)) {
|
|
100
|
+
if (value === null) {
|
|
101
|
+
excludedContributedProfiles.push(profileName);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const filteredContributedProfiles = Array.from(this.rawContributedProfiles.filter((p) => !excludedContributedProfiles.includes(p.title)));
|
|
105
|
+
const contributedProfilesChanged = !equals(filteredContributedProfiles, this._contributedProfiles, contributedProfilesEqual);
|
|
106
|
+
this._contributedProfiles = filteredContributedProfiles;
|
|
107
|
+
return contributedProfilesChanged;
|
|
108
|
+
}
|
|
109
|
+
async _refreshAvailableProfilesNow() {
|
|
110
|
+
const profiles = await this._detectProfiles(true);
|
|
111
|
+
const profilesChanged = !equals(profiles, this._availableProfiles, profilesEqual);
|
|
112
|
+
const contributedProfilesChanged = await this._updateContributedProfiles();
|
|
113
|
+
if (profilesChanged || contributedProfilesChanged) {
|
|
114
|
+
this._availableProfiles = profiles;
|
|
115
|
+
this._profilesReadyBarrier.open();
|
|
116
|
+
this._onDidChangeAvailableProfiles.fire(this._availableProfiles);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async getContributedDefaultProfile(shellLaunchConfig) {
|
|
120
|
+
// prevents recursion with the MainThreadTerminalService call to create terminal
|
|
121
|
+
// and defers to the provided launch config when an executable is provided
|
|
122
|
+
if (shellLaunchConfig && !shellLaunchConfig.extHostTerminalId && !('executable' in shellLaunchConfig)) {
|
|
123
|
+
const key = await this.terminalService.getCodePlatformKey();
|
|
124
|
+
const defaultProfileName = this.preferenceService.get(`${"terminal.integrated.defaultProfile." /* CodeTerminalSettingPrefix.DefaultProfile */}${key}`);
|
|
125
|
+
const contributedDefaultProfile = this.contributedProfiles.find((p) => p.title === defaultProfileName);
|
|
126
|
+
return contributedDefaultProfile;
|
|
127
|
+
}
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
async saveContributedProfile(args) {
|
|
131
|
+
const platformKey = await this.terminalService.getCodePlatformKey();
|
|
132
|
+
const profilesConfig = await this.preferenceService.get(`${"terminal.integrated.profiles." /* CodeTerminalSettingPrefix.Profiles */}${platformKey}`);
|
|
133
|
+
if (typeof profilesConfig === 'object') {
|
|
134
|
+
const newProfile = {
|
|
135
|
+
extensionIdentifier: args.extensionIdentifier,
|
|
136
|
+
icon: args.options.icon,
|
|
137
|
+
id: args.id,
|
|
138
|
+
title: args.title,
|
|
139
|
+
color: args.options.color,
|
|
140
|
+
};
|
|
141
|
+
profilesConfig[args.title] = newProfile;
|
|
142
|
+
}
|
|
143
|
+
await this.preferenceService.set(`${"terminal.integrated.profiles." /* CodeTerminalSettingPrefix.Profiles */}${platformKey}`, profilesConfig, ide_core_common_1.PreferenceScope.User);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
get rawContributedProfiles() {
|
|
147
|
+
return Array.from(this._rawContributedProfileMap.values());
|
|
148
|
+
}
|
|
149
|
+
addContributedProfile(extensionId, contributions) {
|
|
150
|
+
var _a;
|
|
151
|
+
const profiles = ((_a = contributions === null || contributions === void 0 ? void 0 : contributions.profiles) === null || _a === void 0 ? void 0 : _a.filter((p) => hasValidTerminalIcon(p)).map((e) => ({ ...e, extensionIdentifier: extensionId }))) || [];
|
|
152
|
+
for (const profile of profiles) {
|
|
153
|
+
this._rawContributedProfileMap.set(profile.id, profile);
|
|
154
|
+
}
|
|
155
|
+
this.refreshAvailableProfiles();
|
|
156
|
+
}
|
|
157
|
+
removeContributedProfile(extensionId) {
|
|
158
|
+
const profiles = this.rawContributedProfiles;
|
|
159
|
+
for (const profile of profiles) {
|
|
160
|
+
if (profile.extensionIdentifier === extensionId) {
|
|
161
|
+
this._rawContributedProfileMap.delete(profile.id);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
exports.TerminalProfileService = TerminalProfileService;
|
|
167
|
+
tslib_1.__decorate([
|
|
168
|
+
(0, di_1.Autowired)(common_1.ITerminalService),
|
|
169
|
+
tslib_1.__metadata("design:type", Object)
|
|
170
|
+
], TerminalProfileService.prototype, "terminalService", void 0);
|
|
171
|
+
tslib_1.__decorate([
|
|
172
|
+
(0, di_1.Autowired)(ide_core_browser_1.PreferenceService),
|
|
173
|
+
tslib_1.__metadata("design:type", Object)
|
|
174
|
+
], TerminalProfileService.prototype, "preferenceService", void 0);
|
|
175
|
+
tslib_1.__decorate([
|
|
176
|
+
(0, di_1.Autowired)(ide_core_common_1.ILogger),
|
|
177
|
+
tslib_1.__metadata("design:type", Object)
|
|
178
|
+
], TerminalProfileService.prototype, "logger", void 0);
|
|
179
|
+
tslib_1.__decorate([
|
|
180
|
+
(0, ide_core_common_1.throttle)(2000),
|
|
181
|
+
tslib_1.__metadata("design:type", Function),
|
|
182
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
183
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
184
|
+
], TerminalProfileService.prototype, "refreshAvailableProfiles", null);
|
|
185
|
+
exports.TerminalProfileService = TerminalProfileService = tslib_1.__decorate([
|
|
186
|
+
(0, di_1.Injectable)(),
|
|
187
|
+
tslib_1.__metadata("design:paramtypes", [])
|
|
188
|
+
], TerminalProfileService);
|
|
189
|
+
function profilesEqual(one, other) {
|
|
190
|
+
return (one.profileName === other.profileName &&
|
|
191
|
+
(0, common_1.terminalProfileArgsMatch)(one.args, other.args) &&
|
|
192
|
+
one.color === other.color &&
|
|
193
|
+
one.isAutoDetected === other.isAutoDetected &&
|
|
194
|
+
one.isDefault === other.isDefault &&
|
|
195
|
+
one.overrideName === other.overrideName &&
|
|
196
|
+
one.path === other.path);
|
|
197
|
+
}
|
|
198
|
+
function contributedProfilesEqual(one, other) {
|
|
199
|
+
return (one.extensionIdentifier === other.extensionIdentifier &&
|
|
200
|
+
one.color === other.color &&
|
|
201
|
+
one.icon === other.icon &&
|
|
202
|
+
one.id === other.id &&
|
|
203
|
+
one.title === other.title);
|
|
204
|
+
}
|
|
205
|
+
function hasValidTerminalIcon(profile) {
|
|
206
|
+
return (!profile.icon ||
|
|
207
|
+
typeof profile.icon === 'string' ||
|
|
208
|
+
ide_core_common_1.URI.isUri(profile.icon) ||
|
|
209
|
+
('light' in profile.icon && 'dark' in profile.icon && ide_core_common_1.URI.isUri(profile.icon.light) && ide_core_common_1.URI.isUri(profile.icon.dark)));
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=terminal.profile.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TerminalRenderProvider = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
const tab_item_1 = require("./component/tab.item");
|
|
7
|
+
let TerminalRenderProvider = class TerminalRenderProvider {
|
|
8
|
+
/**
|
|
9
|
+
* @override terminal tab item renderer
|
|
10
|
+
*/
|
|
11
|
+
get infoItemRender() {
|
|
12
|
+
return tab_item_1.renderInfoItem;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @override terminal add item renderer
|
|
16
|
+
*/
|
|
17
|
+
get addItemRender() {
|
|
18
|
+
return tab_item_1.renderAddItem;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.TerminalRenderProvider = TerminalRenderProvider;
|
|
22
|
+
exports.TerminalRenderProvider = TerminalRenderProvider = tslib_1.__decorate([
|
|
23
|
+
(0, di_1.Injectable)()
|
|
24
|
+
], TerminalRenderProvider);
|
|
25
|
+
//# sourceMappingURL=terminal.render.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TerminalRestore = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const di_1 = require("@opensumi/di");
|
|
6
|
+
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
const DEFAULT_TERMINAL_STORE_KEY = 'OPENSUMI_TERMINAL_RESTORE';
|
|
9
|
+
let TerminalRestore = class TerminalRestore extends ide_core_browser_1.Disposable {
|
|
10
|
+
get storageKey() {
|
|
11
|
+
// 集成方可以根据自己的场景来通过 override 自定义 storageKey 做到终端恢复场景的准确性
|
|
12
|
+
return DEFAULT_TERMINAL_STORE_KEY;
|
|
13
|
+
}
|
|
14
|
+
save() {
|
|
15
|
+
const json = this.controller.toJSON();
|
|
16
|
+
const key = this.storageKey;
|
|
17
|
+
this.scopedBrowserStorageService.setData(key, json);
|
|
18
|
+
}
|
|
19
|
+
restore() {
|
|
20
|
+
const key = this.storageKey;
|
|
21
|
+
const history = this.scopedBrowserStorageService.getData(key);
|
|
22
|
+
if (history) {
|
|
23
|
+
try {
|
|
24
|
+
return this.controller.recovery(history);
|
|
25
|
+
}
|
|
26
|
+
catch (_e) {
|
|
27
|
+
/** nothing */
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.TerminalRestore = TerminalRestore;
|
|
34
|
+
tslib_1.__decorate([
|
|
35
|
+
(0, di_1.Autowired)(common_1.ITerminalController),
|
|
36
|
+
tslib_1.__metadata("design:type", Object)
|
|
37
|
+
], TerminalRestore.prototype, "controller", void 0);
|
|
38
|
+
tslib_1.__decorate([
|
|
39
|
+
(0, di_1.Autowired)(common_1.ITerminalInternalService),
|
|
40
|
+
tslib_1.__metadata("design:type", Object)
|
|
41
|
+
], TerminalRestore.prototype, "service", void 0);
|
|
42
|
+
tslib_1.__decorate([
|
|
43
|
+
(0, di_1.Autowired)(ide_core_browser_1.ScopedBrowserStorageService),
|
|
44
|
+
tslib_1.__metadata("design:type", ide_core_browser_1.ScopedBrowserStorageService)
|
|
45
|
+
], TerminalRestore.prototype, "scopedBrowserStorageService", void 0);
|
|
46
|
+
exports.TerminalRestore = TerminalRestore = tslib_1.__decorate([
|
|
47
|
+
(0, di_1.Injectable)()
|
|
48
|
+
], TerminalRestore);
|
|
49
|
+
//# sourceMappingURL=terminal.restore.js.map
|