@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.
Files changed (244) hide show
  1. package/LICENSE +21 -0
  2. package/lib/browser/component/resize.delegate.d.ts +14 -0
  3. package/lib/browser/component/resize.delegate.d.ts.map +1 -0
  4. package/lib/browser/component/resize.delegate.js +46 -0
  5. package/lib/browser/component/resize.delegate.js.map +1 -0
  6. package/lib/browser/component/resize.module.less +77 -0
  7. package/lib/browser/component/resize.view.d.ts +16 -0
  8. package/lib/browser/component/resize.view.d.ts.map +1 -0
  9. package/lib/browser/component/resize.view.js +55 -0
  10. package/lib/browser/component/resize.view.js.map +1 -0
  11. package/lib/browser/component/search.module.less +61 -0
  12. package/lib/browser/component/search.view.d.ts +3 -0
  13. package/lib/browser/component/search.view.d.ts.map +1 -0
  14. package/lib/browser/component/search.view.js +89 -0
  15. package/lib/browser/component/search.view.js.map +1 -0
  16. package/lib/browser/component/tab.item.d.ts +7 -0
  17. package/lib/browser/component/tab.item.d.ts.map +1 -0
  18. package/lib/browser/component/tab.item.js +121 -0
  19. package/lib/browser/component/tab.item.js.map +1 -0
  20. package/lib/browser/component/tab.module.less +174 -0
  21. package/lib/browser/component/tab.view.d.ts +4 -0
  22. package/lib/browser/component/tab.view.d.ts.map +1 -0
  23. package/lib/browser/component/tab.view.js +65 -0
  24. package/lib/browser/component/tab.view.js.map +1 -0
  25. package/lib/browser/component/terminal.module.less +50 -0
  26. package/lib/browser/component/terminal.variable.d.ts +8 -0
  27. package/lib/browser/component/terminal.variable.d.ts.map +1 -0
  28. package/lib/browser/component/terminal.variable.js +44 -0
  29. package/lib/browser/component/terminal.variable.js.map +1 -0
  30. package/lib/browser/component/terminal.view.d.ts +5 -0
  31. package/lib/browser/component/terminal.view.d.ts.map +1 -0
  32. package/lib/browser/component/terminal.view.js +63 -0
  33. package/lib/browser/component/terminal.view.js.map +1 -0
  34. package/lib/browser/component/terminal.widget.d.ts +10 -0
  35. package/lib/browser/component/terminal.widget.d.ts.map +1 -0
  36. package/lib/browser/component/terminal.widget.js +65 -0
  37. package/lib/browser/component/terminal.widget.js.map +1 -0
  38. package/lib/browser/component/variable.module.less +15 -0
  39. package/lib/browser/contribution/index.d.ts.map +1 -0
  40. package/lib/browser/contribution/index.js +11 -0
  41. package/lib/browser/contribution/index.js.map +1 -0
  42. package/lib/browser/contribution/terminal.command.js +328 -0
  43. package/lib/browser/contribution/terminal.keybinding.js +87 -0
  44. package/lib/browser/contribution/terminal.lifecycle.js +52 -0
  45. package/lib/browser/contribution/terminal.menu.js +168 -0
  46. package/lib/browser/contribution/terminal.network.js +44 -0
  47. package/lib/browser/contribution/terminal.preference.js +43 -0
  48. package/lib/browser/contribution/terminal.view.js +57 -0
  49. package/lib/browser/index.js +124 -0
  50. package/lib/browser/links/base.d.ts +8 -0
  51. package/lib/browser/links/base.d.ts.map +1 -0
  52. package/lib/browser/links/base.js +13 -0
  53. package/lib/browser/links/base.js.map +1 -0
  54. package/lib/browser/links/external-link-provider-adapter.d.ts +21 -0
  55. package/lib/browser/links/external-link-provider-adapter.d.ts.map +1 -0
  56. package/lib/browser/links/external-link-provider-adapter.js +74 -0
  57. package/lib/browser/links/external-link-provider-adapter.js.map +1 -0
  58. package/lib/browser/links/helpers.d.ts +7 -0
  59. package/lib/browser/links/helpers.d.ts.map +1 -0
  60. package/lib/browser/links/helpers.js +128 -0
  61. package/lib/browser/links/helpers.js.map +1 -0
  62. package/lib/browser/links/link-manager.d.ts +92 -0
  63. package/lib/browser/links/link-manager.d.ts.map +1 -0
  64. package/lib/browser/links/link-manager.js +342 -0
  65. package/lib/browser/links/link-manager.js.map +1 -0
  66. package/lib/browser/links/link.d.ts +31 -0
  67. package/lib/browser/links/link.d.ts.map +1 -0
  68. package/lib/browser/links/link.js +136 -0
  69. package/lib/browser/links/link.js.map +1 -0
  70. package/lib/browser/links/protocol-link-provider.d.ts +14 -0
  71. package/lib/browser/links/protocol-link-provider.d.ts.map +1 -0
  72. package/lib/browser/links/protocol-link-provider.js +71 -0
  73. package/lib/browser/links/protocol-link-provider.js.map +1 -0
  74. package/lib/browser/links/validated-local-link-provider.d.ts +41 -0
  75. package/lib/browser/links/validated-local-link-provider.d.ts.map +1 -0
  76. package/lib/browser/links/validated-local-link-provider.js +235 -0
  77. package/lib/browser/links/validated-local-link-provider.js.map +1 -0
  78. package/lib/browser/links/word-link-provider.d.ts +29 -0
  79. package/lib/browser/links/word-link-provider.d.ts.map +1 -0
  80. package/lib/browser/links/word-link-provider.js +153 -0
  81. package/lib/browser/links/word-link-provider.js.map +1 -0
  82. package/lib/browser/terminal.addon.js +83 -0
  83. package/lib/browser/terminal.api.js +162 -0
  84. package/lib/browser/terminal.client.js +680 -0
  85. package/lib/browser/terminal.color.js +240 -0
  86. package/lib/browser/terminal.context-key.js +29 -0
  87. package/lib/browser/terminal.context-menu.js +96 -0
  88. package/lib/browser/terminal.controller.js +669 -0
  89. package/lib/browser/terminal.environment.service.js +153 -0
  90. package/lib/browser/terminal.error.js +61 -0
  91. package/lib/browser/terminal.ext.host.proxy.js +108 -0
  92. package/lib/browser/terminal.hover.manager.js +85 -0
  93. package/lib/browser/terminal.input.js +32 -0
  94. package/lib/browser/terminal.internal.service.js +107 -0
  95. package/lib/browser/terminal.network.js +150 -0
  96. package/lib/browser/terminal.preference.js +136 -0
  97. package/lib/browser/terminal.profile.internal.js +104 -0
  98. package/lib/browser/terminal.profile.js +211 -0
  99. package/lib/browser/terminal.render.js +25 -0
  100. package/lib/browser/terminal.restore.js +49 -0
  101. package/lib/browser/terminal.search.js +109 -0
  102. package/lib/browser/terminal.service.js +163 -0
  103. package/lib/common/api.d.ts +22 -0
  104. package/lib/common/api.d.ts.map +1 -0
  105. package/lib/common/api.js +5 -0
  106. package/lib/common/api.js.map +1 -0
  107. package/lib/common/client.d.ts +199 -0
  108. package/lib/common/client.d.ts.map +1 -0
  109. package/lib/common/client.js +6 -0
  110. package/lib/common/client.js.map +1 -0
  111. package/lib/common/controller.d.ts +149 -0
  112. package/lib/common/controller.d.ts.map +1 -0
  113. package/lib/common/controller.js +8 -0
  114. package/lib/common/controller.js.map +1 -0
  115. package/lib/common/environmentVariable.d.ts +116 -0
  116. package/lib/common/environmentVariable.d.ts.map +1 -0
  117. package/lib/common/environmentVariable.js +30 -0
  118. package/lib/common/environmentVariable.js.map +1 -0
  119. package/lib/common/environmentVariableCollection.d.ts +9 -0
  120. package/lib/common/environmentVariableCollection.d.ts.map +1 -0
  121. package/lib/common/environmentVariableCollection.js +140 -0
  122. package/lib/common/environmentVariableCollection.js.map +1 -0
  123. package/lib/common/error.d.ts +41 -0
  124. package/lib/common/error.d.ts.map +1 -0
  125. package/lib/common/error.js +13 -0
  126. package/lib/common/error.js.map +1 -0
  127. package/lib/common/extension.d.ts +139 -0
  128. package/lib/common/extension.d.ts.map +1 -0
  129. package/lib/common/extension.js +57 -0
  130. package/lib/common/extension.js.map +1 -0
  131. package/lib/common/index.d.ts +17 -0
  132. package/lib/common/index.d.ts.map +1 -0
  133. package/lib/common/index.js +20 -0
  134. package/lib/common/index.js.map +1 -0
  135. package/lib/common/link-computer.d.ts +56 -0
  136. package/lib/common/link-computer.d.ts.map +1 -0
  137. package/lib/common/link-computer.js +282 -0
  138. package/lib/common/link-computer.js.map +1 -0
  139. package/lib/common/network.d.ts +48 -0
  140. package/lib/common/network.d.ts.map +1 -0
  141. package/lib/common/network.js +10 -0
  142. package/lib/common/network.js.map +1 -0
  143. package/lib/common/preference.d.ts +134 -0
  144. package/lib/common/preference.d.ts.map +1 -0
  145. package/lib/common/preference.js +199 -0
  146. package/lib/common/preference.js.map +1 -0
  147. package/lib/common/process.d.ts +8 -0
  148. package/lib/common/process.d.ts.map +1 -0
  149. package/lib/common/process.js +3 -0
  150. package/lib/common/process.js.map +1 -0
  151. package/lib/common/profile.d.ts +99 -0
  152. package/lib/common/profile.d.ts.map +1 -0
  153. package/lib/common/profile.js +27 -0
  154. package/lib/common/profile.js.map +1 -0
  155. package/lib/common/pty.d.ts +525 -0
  156. package/lib/common/pty.d.ts.map +1 -0
  157. package/lib/common/pty.js +28 -0
  158. package/lib/common/pty.js.map +1 -0
  159. package/lib/common/render.d.ts +29 -0
  160. package/lib/common/render.d.ts.map +1 -0
  161. package/lib/common/render.js +10 -0
  162. package/lib/common/render.js.map +1 -0
  163. package/lib/common/resize.d.ts +43 -0
  164. package/lib/common/resize.d.ts.map +1 -0
  165. package/lib/common/resize.js +3 -0
  166. package/lib/common/resize.js.map +1 -0
  167. package/lib/common/restore.d.ts +6 -0
  168. package/lib/common/restore.d.ts.map +1 -0
  169. package/lib/common/restore.js +5 -0
  170. package/lib/common/restore.js.map +1 -0
  171. package/lib/common/service.d.ts +96 -0
  172. package/lib/common/service.d.ts.map +1 -0
  173. package/lib/common/service.js +6 -0
  174. package/lib/common/service.js.map +1 -0
  175. package/lib/common/shell.d.ts +11 -0
  176. package/lib/common/shell.d.ts.map +1 -0
  177. package/lib/common/shell.js +14 -0
  178. package/lib/common/shell.js.map +1 -0
  179. package/lib/common/theme.d.ts +6 -0
  180. package/lib/common/theme.d.ts.map +1 -0
  181. package/lib/common/theme.js +5 -0
  182. package/lib/common/theme.js.map +1 -0
  183. package/lib/common/utils.d.ts +4 -0
  184. package/lib/common/utils.d.ts.map +1 -0
  185. package/lib/common/utils.js +15 -0
  186. package/lib/common/utils.js.map +1 -0
  187. package/lib/common/xterm.d.ts +27 -0
  188. package/lib/common/xterm.d.ts.map +1 -0
  189. package/lib/common/xterm.js +10 -0
  190. package/lib/common/xterm.js.map +1 -0
  191. package/lib/index.js +5 -0
  192. package/lib/node/data-store.d.ts +13 -0
  193. package/lib/node/data-store.d.ts.map +1 -0
  194. package/lib/node/data-store.js +6 -0
  195. package/lib/node/data-store.js.map +1 -0
  196. package/lib/node/index.d.ts +10 -0
  197. package/lib/node/index.d.ts.map +1 -0
  198. package/lib/node/index.js +64 -0
  199. package/lib/node/index.js.map +1 -0
  200. package/lib/node/pty.d.ts +42 -0
  201. package/lib/node/pty.d.ts.map +1 -0
  202. package/lib/node/pty.js +277 -0
  203. package/lib/node/pty.js.map +1 -0
  204. package/lib/node/pty.manager.d.ts +52 -0
  205. package/lib/node/pty.manager.d.ts.map +1 -0
  206. package/lib/node/pty.manager.js +157 -0
  207. package/lib/node/pty.manager.js.map +1 -0
  208. package/lib/node/pty.manager.remote.d.ts +23 -0
  209. package/lib/node/pty.manager.remote.d.ts.map +1 -0
  210. package/lib/node/pty.manager.remote.js +124 -0
  211. package/lib/node/pty.manager.remote.js.map +1 -0
  212. package/lib/node/pty.proxy.d.ts +45 -0
  213. package/lib/node/pty.proxy.d.ts.map +1 -0
  214. package/lib/node/pty.proxy.js +277 -0
  215. package/lib/node/pty.proxy.js.map +1 -0
  216. package/lib/node/pty.proxy.remote.exec.d.ts +2 -0
  217. package/lib/node/pty.proxy.remote.exec.d.ts.map +1 -0
  218. package/lib/node/pty.proxy.remote.exec.js +7 -0
  219. package/lib/node/pty.proxy.remote.exec.js.map +1 -0
  220. package/lib/node/shell-integration.service.d.ts +24 -0
  221. package/lib/node/shell-integration.service.d.ts.map +1 -0
  222. package/lib/node/shell-integration.service.js +187 -0
  223. package/lib/node/shell-integration.service.js.map +1 -0
  224. package/lib/node/shell.d.ts +20 -0
  225. package/lib/node/shell.d.ts.map +1 -0
  226. package/lib/node/shell.js +199 -0
  227. package/lib/node/shell.js.map +1 -0
  228. package/lib/node/terminal.process.service.d.ts +5 -0
  229. package/lib/node/terminal.process.service.d.ts.map +1 -0
  230. package/lib/node/terminal.process.service.js +15 -0
  231. package/lib/node/terminal.process.service.js.map +1 -0
  232. package/lib/node/terminal.profile.service.d.ts +19 -0
  233. package/lib/node/terminal.profile.service.d.ts.map +1 -0
  234. package/lib/node/terminal.profile.service.js +228 -0
  235. package/lib/node/terminal.profile.service.js.map +1 -0
  236. package/lib/node/terminal.service.client.d.ts +51 -0
  237. package/lib/node/terminal.service.client.d.ts.map +1 -0
  238. package/lib/node/terminal.service.client.js +159 -0
  239. package/lib/node/terminal.service.client.js.map +1 -0
  240. package/lib/node/terminal.service.d.ts +30 -0
  241. package/lib/node/terminal.service.d.ts.map +1 -0
  242. package/lib/node/terminal.service.js +246 -0
  243. package/lib/node/terminal.service.js.map +1 -0
  244. package/package.json +18 -18
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalEnvironmentService = exports.ENVIRONMENT_VARIABLE_COLLECTIONS_KEY = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const debounce_1 = tslib_1.__importDefault(require("lodash/debounce"));
6
+ const throttle_1 = tslib_1.__importDefault(require("lodash/throttle"));
7
+ const react_1 = tslib_1.__importDefault(require("react"));
8
+ const di_1 = require("@opensumi/di");
9
+ const ide_core_browser_1 = require("@opensumi/ide-core-browser");
10
+ const ide_core_common_1 = require("@opensumi/ide-core-common");
11
+ const common_1 = require("@opensumi/ide-overlay/lib/common");
12
+ const common_2 = require("@opensumi/ide-status-bar/lib/common");
13
+ const common_3 = require("@opensumi/ide-workspace/lib/common");
14
+ const common_4 = require("../common");
15
+ const environmentVariable_1 = require("../common/environmentVariable");
16
+ const environmentVariableCollection_1 = require("../common/environmentVariableCollection");
17
+ const terminal_variable_1 = require("./component/terminal.variable");
18
+ exports.ENVIRONMENT_VARIABLE_COLLECTIONS_KEY = 'terminal.integrated.environmentVariableCollections';
19
+ const ENVIRONMENT_VARIABLE_CHANGED_STATUS = 'terminal.environmentVariableCollections.changed';
20
+ let TerminalEnvironmentService = class TerminalEnvironmentService {
21
+ constructor() {
22
+ this.collections = new Map();
23
+ this._onDidChangeCollections = new ide_core_common_1.Emitter();
24
+ }
25
+ get onDidChangeCollections() {
26
+ return this._onDidChangeCollections.event;
27
+ }
28
+ async initEnvironmentVariableCollections() {
29
+ const serializedCollections = await this.storageService.getData(exports.ENVIRONMENT_VARIABLE_COLLECTIONS_KEY);
30
+ if (serializedCollections) {
31
+ try {
32
+ const collectionsJson = JSON.parse(serializedCollections);
33
+ collectionsJson.forEach((c) => {
34
+ this.collections.set(c.extensionIdentifier, {
35
+ persistent: true,
36
+ map: (0, environmentVariable_1.deserializeEnvironmentVariableCollection)(c.collection),
37
+ });
38
+ });
39
+ }
40
+ catch (err) {
41
+ this.logger.warn(`parse environment variable collection error: \n ${err.message}, data: \n ${serializedCollections}`);
42
+ }
43
+ }
44
+ this.mergedCollection = this.resolveMergedCollection();
45
+ this.previousMergedCollection = undefined;
46
+ }
47
+ set(extensionIdentifier, collection) {
48
+ this.collections.set(extensionIdentifier, collection);
49
+ this.updateCollections();
50
+ }
51
+ delete(extensionIdentifier) {
52
+ this.collections.delete(extensionIdentifier);
53
+ this.updateCollections();
54
+ }
55
+ async getProcessEnv() {
56
+ return (0, ide_core_common_1.raceTimeout)(this.terminalProcessService.getEnv(), 1000);
57
+ }
58
+ resolveMergedCollection() {
59
+ return new environmentVariableCollection_1.MergedEnvironmentVariableCollection(this.collections);
60
+ }
61
+ onDidClickStatusBarEntry(diff) {
62
+ this.dialogService
63
+ .warning(react_1.default.createElement(terminal_variable_1.TerminalVariable, { diff }), [
64
+ (0, ide_core_common_1.localize)('dialog.file.close'),
65
+ (0, ide_core_common_1.localize)('terminal.relaunch'),
66
+ ])
67
+ .then((res) => {
68
+ var _a;
69
+ if (res && res === (0, ide_core_common_1.localize)('terminal.relaunch')) {
70
+ this.commandService.executeCommand(ide_core_browser_1.TERMINAL_COMMANDS.RE_LAUNCH.id);
71
+ (_a = this.statusBarEntryAccessor) === null || _a === void 0 ? void 0 : _a.dispose();
72
+ this.statusBarEntryAccessor = undefined;
73
+ }
74
+ });
75
+ }
76
+ updateStatusBarMessage() {
77
+ var _a;
78
+ if (!this.mergedCollection) {
79
+ return;
80
+ }
81
+ const diff = (_a = this.previousMergedCollection) === null || _a === void 0 ? void 0 : _a.diff(this.mergedCollection);
82
+ if (!diff) {
83
+ return;
84
+ }
85
+ if (this.statusBarEntryAccessor) {
86
+ this.statusBarEntryAccessor.dispose();
87
+ this.statusBarEntryAccessor = undefined;
88
+ }
89
+ const changes = [];
90
+ this.mergedCollection.map.forEach((mutators, variable) => {
91
+ mutators.forEach((mutator) => changes.push((0, environmentVariable_1.mutatorTypeLabel)(mutator.type, mutator.value, variable)));
92
+ });
93
+ this.statusBarEntryAccessor = this.statusbarService.addElement(ENVIRONMENT_VARIABLE_CHANGED_STATUS, {
94
+ iconClass: (0, ide_core_browser_1.getIcon)('warning-circle'),
95
+ color: 'orange',
96
+ alignment: ide_core_browser_1.StatusBarAlignment.RIGHT,
97
+ tooltip: (0, ide_core_common_1.toMarkdownString)((0, ide_core_common_1.localize)('terminal.environment.changed') + '\n\n```\n' + changes.join('\n') + '\n```'),
98
+ onClick: () => this.onDidClickStatusBarEntry(diff),
99
+ });
100
+ }
101
+ notifyCollectionUpdates() {
102
+ this._onDidChangeCollections.fire(this.mergedCollection);
103
+ this.updateStatusBarMessage();
104
+ }
105
+ updateCollections() {
106
+ (0, throttle_1.default)(this.persistCollections.bind(this), 100)();
107
+ this.previousMergedCollection = this.mergedCollection;
108
+ this.mergedCollection = this.resolveMergedCollection();
109
+ (0, debounce_1.default)(this.notifyCollectionUpdates.bind(this), 1000)();
110
+ }
111
+ persistCollections() {
112
+ const collectionsJson = [];
113
+ this.collections.forEach((collection, extensionIdentifier) => {
114
+ if (collection.persistent) {
115
+ collectionsJson.push({
116
+ extensionIdentifier,
117
+ collection: (0, environmentVariable_1.serializeEnvironmentVariableCollection)(this.collections.get(extensionIdentifier).map),
118
+ });
119
+ }
120
+ });
121
+ const stringifiedJson = JSON.stringify(collectionsJson);
122
+ this.storageService.setData(exports.ENVIRONMENT_VARIABLE_COLLECTIONS_KEY, stringifiedJson);
123
+ }
124
+ };
125
+ exports.TerminalEnvironmentService = TerminalEnvironmentService;
126
+ tslib_1.__decorate([
127
+ (0, di_1.Autowired)(common_3.IWorkspaceStorageService),
128
+ tslib_1.__metadata("design:type", Object)
129
+ ], TerminalEnvironmentService.prototype, "storageService", void 0);
130
+ tslib_1.__decorate([
131
+ (0, di_1.Autowired)(common_2.IStatusBarService),
132
+ tslib_1.__metadata("design:type", Object)
133
+ ], TerminalEnvironmentService.prototype, "statusbarService", void 0);
134
+ tslib_1.__decorate([
135
+ (0, di_1.Autowired)(common_4.ITerminalProcessPath),
136
+ tslib_1.__metadata("design:type", Object)
137
+ ], TerminalEnvironmentService.prototype, "terminalProcessService", void 0);
138
+ tslib_1.__decorate([
139
+ (0, di_1.Autowired)(common_1.IDialogService),
140
+ tslib_1.__metadata("design:type", Object)
141
+ ], TerminalEnvironmentService.prototype, "dialogService", void 0);
142
+ tslib_1.__decorate([
143
+ (0, di_1.Autowired)(ide_core_common_1.CommandService),
144
+ tslib_1.__metadata("design:type", Object)
145
+ ], TerminalEnvironmentService.prototype, "commandService", void 0);
146
+ tslib_1.__decorate([
147
+ (0, di_1.Autowired)(ide_core_common_1.ILogger),
148
+ tslib_1.__metadata("design:type", Object)
149
+ ], TerminalEnvironmentService.prototype, "logger", void 0);
150
+ exports.TerminalEnvironmentService = TerminalEnvironmentService = tslib_1.__decorate([
151
+ (0, di_1.Injectable)()
152
+ ], TerminalEnvironmentService);
153
+ //# sourceMappingURL=terminal.environment.service.js.map
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalErrorService = 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 TerminalErrorService = class TerminalErrorService {
9
+ constructor() {
10
+ this.errors = new Map();
11
+ this._onErrorsChangeEmitter = new ide_core_common_1.Emitter();
12
+ this.onErrorsChange = this._onErrorsChangeEmitter.event;
13
+ this.service.onError((error) => {
14
+ this.errors.set(error.id, error);
15
+ this._onErrorsChangeEmitter.fire();
16
+ });
17
+ this.service.onExit((event) => {
18
+ try {
19
+ const widget = this.view.getWidget(event.sessionId);
20
+ if (!widget.reuse) {
21
+ this.view.removeWidget(event.sessionId);
22
+ }
23
+ }
24
+ catch (_e) {
25
+ /** nothing */
26
+ }
27
+ });
28
+ this.controller.onDidCloseTerminal((e) => {
29
+ this.errors.delete(e.id);
30
+ this._onErrorsChangeEmitter.fire();
31
+ });
32
+ }
33
+ async fix(clientId) {
34
+ const client = this.controller.findClientFromWidgetId(clientId);
35
+ if (client) {
36
+ await 0; // 使后面的 delete 发生在下一个 microTask 中,避免在迭代过程中修改 this.errors
37
+ this.errors.delete(clientId);
38
+ this._onErrorsChangeEmitter.fire();
39
+ client.reset();
40
+ return client.attached.promise;
41
+ }
42
+ }
43
+ };
44
+ exports.TerminalErrorService = TerminalErrorService;
45
+ tslib_1.__decorate([
46
+ (0, di_1.Autowired)(common_1.ITerminalService),
47
+ tslib_1.__metadata("design:type", Object)
48
+ ], TerminalErrorService.prototype, "service", void 0);
49
+ tslib_1.__decorate([
50
+ (0, di_1.Autowired)(common_1.ITerminalController),
51
+ tslib_1.__metadata("design:type", Object)
52
+ ], TerminalErrorService.prototype, "controller", void 0);
53
+ tslib_1.__decorate([
54
+ (0, di_1.Autowired)(common_1.ITerminalGroupViewService),
55
+ tslib_1.__metadata("design:type", Object)
56
+ ], TerminalErrorService.prototype, "view", void 0);
57
+ exports.TerminalErrorService = TerminalErrorService = tslib_1.__decorate([
58
+ (0, di_1.Injectable)(),
59
+ tslib_1.__metadata("design:paramtypes", [])
60
+ ], TerminalErrorService);
61
+ //# sourceMappingURL=terminal.error.js.map
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalProcessExtHostProxy = void 0;
4
+ const ide_core_common_1 = require("@opensumi/ide-core-common");
5
+ class TerminalProcessExtHostProxy extends ide_core_common_1.Disposable {
6
+ get onProcessReady() {
7
+ return this._onProcessReady.event;
8
+ }
9
+ get onProcessOverrideDimensions() {
10
+ return this._onProcessOverrideDimensions.event;
11
+ }
12
+ constructor(terminalId, _cols, _rows, controller) {
13
+ super();
14
+ this.terminalId = terminalId;
15
+ this._cols = _cols;
16
+ this._rows = _rows;
17
+ this.controller = controller;
18
+ this._onProcessData = this.registerDispose(new ide_core_common_1.Emitter());
19
+ this.onProcessData = this._onProcessData.event;
20
+ this._onProcessExit = this.registerDispose(new ide_core_common_1.Emitter());
21
+ this.onProcessExit = this._onProcessExit.event;
22
+ this._onProcessReady = this.registerDispose(new ide_core_common_1.Emitter());
23
+ this._onProcessTitleChanged = this.registerDispose(new ide_core_common_1.Emitter());
24
+ this.onProcessTitleChanged = this._onProcessTitleChanged.event;
25
+ this._onProcessOverrideDimensions = this.registerDispose(new ide_core_common_1.Emitter());
26
+ this._onStart = this.registerDispose(new ide_core_common_1.Emitter());
27
+ this.onStart = this._onStart.event;
28
+ this._onInput = this.registerDispose(new ide_core_common_1.Emitter());
29
+ this.onInput = this._onInput.event;
30
+ this._onResize = this.registerDispose(new ide_core_common_1.Emitter());
31
+ this.onResize = this._onResize.event;
32
+ this._onShutdown = this.registerDispose(new ide_core_common_1.Emitter());
33
+ this.onShutdown = this._onShutdown.event;
34
+ this._onRequestInitialCwd = this.registerDispose(new ide_core_common_1.Emitter());
35
+ this.onRequestInitialCwd = this._onRequestInitialCwd.event;
36
+ this._onRequestCwd = this.registerDispose(new ide_core_common_1.Emitter());
37
+ this.onRequestCwd = this._onRequestCwd.event;
38
+ this._onRequestLatency = this.registerDispose(new ide_core_common_1.Emitter());
39
+ this.onRequestLatency = this._onRequestLatency.event;
40
+ this._pendingInitialCwdRequests = [];
41
+ this._pendingCwdRequests = [];
42
+ this._pendingLatencyRequests = [];
43
+ }
44
+ emitData(data) {
45
+ this._onProcessData.fire(data);
46
+ }
47
+ emitTitle(title) {
48
+ this._onProcessTitleChanged.fire(title);
49
+ }
50
+ emitReady(pid, cwd) {
51
+ this._onProcessReady.fire({ pid, cwd });
52
+ }
53
+ emitExit(exitCode) {
54
+ this._onProcessExit.fire(exitCode);
55
+ this.dispose();
56
+ }
57
+ emitOverrideDimensions(dimensions) {
58
+ this._onProcessOverrideDimensions.fire(dimensions);
59
+ }
60
+ emitInitialCwd(initialCwd) {
61
+ while (this._pendingInitialCwdRequests.length > 0) {
62
+ this._pendingInitialCwdRequests.pop()(initialCwd);
63
+ }
64
+ }
65
+ emitCwd(cwd) {
66
+ while (this._pendingCwdRequests.length > 0) {
67
+ this._pendingCwdRequests.pop()(cwd);
68
+ }
69
+ }
70
+ emitLatency(latency) {
71
+ while (this._pendingLatencyRequests.length > 0) {
72
+ this._pendingLatencyRequests.pop()(latency);
73
+ }
74
+ }
75
+ async start() {
76
+ // 目前仅支持扩展 Terminal
77
+ return this.controller.requestStartExtensionTerminal(this, this._cols, this._rows);
78
+ }
79
+ shutdown(immediate) {
80
+ this._onShutdown.fire(immediate);
81
+ }
82
+ input(data) {
83
+ this._onInput.fire(data);
84
+ }
85
+ resize(cols, rows) {
86
+ this._onResize.fire({ cols, rows });
87
+ }
88
+ getInitialCwd() {
89
+ return new Promise((resolve) => {
90
+ this._onRequestInitialCwd.fire();
91
+ this._pendingInitialCwdRequests.push(resolve);
92
+ });
93
+ }
94
+ getCwd() {
95
+ return new Promise((resolve) => {
96
+ this._onRequestCwd.fire();
97
+ this._pendingCwdRequests.push(resolve);
98
+ });
99
+ }
100
+ getLatency() {
101
+ return new Promise((resolve) => {
102
+ this._onRequestLatency.fire();
103
+ this._pendingLatencyRequests.push(resolve);
104
+ });
105
+ }
106
+ }
107
+ exports.TerminalProcessExtHostProxy = TerminalProcessExtHostProxy;
108
+ //# sourceMappingURL=terminal.ext.host.proxy.js.map
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalHoverManagerService = 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 TIPS_OFFSET_Y = 20;
8
+ const TIPS_OFFSET_X = 5;
9
+ let TerminalHoverManagerService = class TerminalHoverManagerService {
10
+ appendTerminalHoverOverlay() {
11
+ let overlayContainer = document.querySelector('#terminal-link-hover-overlay');
12
+ if (!overlayContainer) {
13
+ overlayContainer = document.createElement('div');
14
+ overlayContainer.id = 'terminal-link-hover-overlay';
15
+ document.body.appendChild(overlayContainer);
16
+ }
17
+ const overlay = document.createElement('div');
18
+ overlay.classList.add('terminal-hover-overlay');
19
+ overlayContainer.appendChild(overlay);
20
+ this.hoverOverlay = overlay;
21
+ }
22
+ appendTerminalHoverContainer() {
23
+ var _a;
24
+ this.hoverWidget = document.createElement('div');
25
+ this.hoverWidget.style.display = 'none';
26
+ this.hoverWidget.style.position = 'fixed';
27
+ this.hoverWidget.style.color = 'var(--editorWidget-foreground)';
28
+ this.hoverWidget.style.backgroundColor = 'var(--editorWidget-background)';
29
+ this.hoverWidget.style.borderColor = 'var(--editorWidget-border)';
30
+ this.hoverWidget.style.borderWidth = '0.5px';
31
+ this.hoverWidget.style.borderStyle = 'solid';
32
+ this.hoverWidget.style.padding = '5px';
33
+ this.hoverWidget.style.top = '-500px';
34
+ this.hoverWidget.style.left = '-500px';
35
+ this.hoverWidget.style.zIndex = '10';
36
+ this.hoverWidget.classList.add('hover-container');
37
+ if (!this.hoverOverlay) {
38
+ this.appendTerminalHoverOverlay();
39
+ }
40
+ (_a = this.hoverOverlay) === null || _a === void 0 ? void 0 : _a.appendChild(this.hoverWidget);
41
+ }
42
+ setHoverOverlay(overlay) {
43
+ this.hoverOverlay = overlay;
44
+ }
45
+ showHover(targetOptions, text, linkHandler) {
46
+ if (!this.hoverWidget) {
47
+ this.appendTerminalHoverContainer();
48
+ }
49
+ const viewportRange = targetOptions.viewportRange;
50
+ const cellDimensions = targetOptions.cellDimensions;
51
+ const boundingClientRect = targetOptions.boundingClientRect;
52
+ if (this.hoverWidget) {
53
+ this.hoverWidget.textContent = text;
54
+ this.hoverWidget.style.display = 'inline';
55
+ }
56
+ // wait for the hover widget to be rendered
57
+ requestAnimationFrame(() => {
58
+ if (this.hoverWidget) {
59
+ this.hoverWidget.style.top = `${(viewportRange.start.y - 1) * cellDimensions.height + boundingClientRect.y - TIPS_OFFSET_Y}px`;
60
+ let tooltipsLeft = viewportRange.start.x * cellDimensions.width + boundingClientRect.x + TIPS_OFFSET_X;
61
+ // if the tooltip is too close to the right edge of the terminal, move it to the left
62
+ if (tooltipsLeft + this.hoverWidget.clientWidth > boundingClientRect.x + boundingClientRect.width) {
63
+ tooltipsLeft = boundingClientRect.x + boundingClientRect.width - this.hoverWidget.clientWidth - TIPS_OFFSET_X;
64
+ }
65
+ this.hoverWidget.style.left = `${tooltipsLeft}px`;
66
+ }
67
+ });
68
+ return ide_core_common_1.Disposable.create(() => this.dispose());
69
+ }
70
+ hideHover() {
71
+ if (this.hoverWidget) {
72
+ this.dispose();
73
+ }
74
+ }
75
+ dispose() {
76
+ var _a;
77
+ (_a = this.hoverWidget) === null || _a === void 0 ? void 0 : _a.remove();
78
+ this.hoverWidget = undefined;
79
+ }
80
+ };
81
+ exports.TerminalHoverManagerService = TerminalHoverManagerService;
82
+ exports.TerminalHoverManagerService = TerminalHoverManagerService = tslib_1.__decorate([
83
+ (0, di_1.Injectable)()
84
+ ], TerminalHoverManagerService);
85
+ //# sourceMappingURL=terminal.hover.manager.js.map
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalKeyBoardInputService = 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
+ let TerminalKeyBoardInputService = class TerminalKeyBoardInputService {
8
+ constructor() {
9
+ this._isCommandOrCtrl = false;
10
+ }
11
+ get isCommandOrCtrl() {
12
+ return this._isCommandOrCtrl;
13
+ }
14
+ listen() {
15
+ const key = ide_core_common_1.isMacintosh ? 'Meta' : 'Control';
16
+ document.addEventListener('keydown', (e) => {
17
+ if (e.key === key) {
18
+ this._isCommandOrCtrl = true;
19
+ }
20
+ });
21
+ document.addEventListener('keyup', (e) => {
22
+ if (e.key === key) {
23
+ this._isCommandOrCtrl = false;
24
+ }
25
+ });
26
+ }
27
+ };
28
+ exports.TerminalKeyBoardInputService = TerminalKeyBoardInputService;
29
+ exports.TerminalKeyBoardInputService = TerminalKeyBoardInputService = tslib_1.__decorate([
30
+ (0, di_1.Injectable)()
31
+ ], TerminalKeyBoardInputService);
32
+ //# sourceMappingURL=terminal.input.js.map
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TerminalInternalService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@opensumi/di");
6
+ const common_1 = require("../common");
7
+ let TerminalInternalService = class TerminalInternalService {
8
+ constructor() {
9
+ this._processExtHostProxies = new Map();
10
+ }
11
+ generateSessionId() {
12
+ return this.service.generateSessionId ? this.service.generateSessionId() : (0, common_1.generateSessionId)();
13
+ }
14
+ getOptions() {
15
+ return this.service.getOptions ? this.service.getOptions() : {};
16
+ }
17
+ check(sessionIds) {
18
+ return this.service.check ? this.service.check(sessionIds) : Promise.resolve(true);
19
+ }
20
+ _getExtHostProxy(longId) {
21
+ return this._processExtHostProxies.get(longId);
22
+ }
23
+ async sendText(sessionId, message) {
24
+ const proxy = this._getExtHostProxy(sessionId);
25
+ if (proxy) {
26
+ return proxy.emitData(message);
27
+ }
28
+ return this.service.sendText(sessionId, message);
29
+ }
30
+ async resize(sessionId, cols, rows) {
31
+ const proxy = this._getExtHostProxy(sessionId);
32
+ if (proxy) {
33
+ return proxy.resize(cols, rows);
34
+ }
35
+ return this.service.resize(sessionId, cols, rows);
36
+ }
37
+ disposeById(sessionId) {
38
+ const proxy = this._getExtHostProxy(sessionId);
39
+ if (proxy) {
40
+ this._processExtHostProxies.delete(sessionId);
41
+ return proxy.dispose();
42
+ }
43
+ return this.service.disposeById(sessionId);
44
+ }
45
+ async getProcessId(sessionId) {
46
+ const proxy = this._getExtHostProxy(sessionId);
47
+ if (proxy) {
48
+ return -1;
49
+ }
50
+ return this.service.getProcessId(sessionId);
51
+ }
52
+ onError(handler) {
53
+ return this.service.onError(handler);
54
+ }
55
+ onExit(handler) {
56
+ return this.service.onExit(handler);
57
+ }
58
+ onProcessChange(handler) {
59
+ return this.service.onProcessChange(handler);
60
+ }
61
+ async getOS() {
62
+ return await this.service.getOS();
63
+ }
64
+ async getProfiles(autoDetect) {
65
+ return await this.service.getProfiles(autoDetect);
66
+ }
67
+ async getDefaultSystemShell() {
68
+ return await this.service.getDefaultSystemShell();
69
+ }
70
+ async getCodePlatformKey() {
71
+ return await this.service.getCodePlatformKey();
72
+ }
73
+ async attachByLaunchConfig(sessionId, cols, rows, launchConfig, xterm) {
74
+ if (launchConfig.customPtyImplementation) {
75
+ const proxy = launchConfig.customPtyImplementation(sessionId, cols, rows);
76
+ proxy.start();
77
+ proxy.onProcessExit(() => {
78
+ this._processExtHostProxies.delete(sessionId);
79
+ });
80
+ this._processExtHostProxies.set(sessionId, proxy);
81
+ return {
82
+ name: launchConfig.name || 'ExtensionTerminal-' + sessionId,
83
+ readonly: false,
84
+ onData: proxy.onProcessData.bind(proxy),
85
+ sendData: proxy.input.bind(proxy),
86
+ onExit: proxy.onProcessExit.bind(proxy),
87
+ };
88
+ }
89
+ return await this.service.attachByLaunchConfig(sessionId, cols, rows, launchConfig, xterm);
90
+ }
91
+ async getCwd(sessionId) {
92
+ return await this.service.getCwd(sessionId);
93
+ }
94
+ };
95
+ exports.TerminalInternalService = TerminalInternalService;
96
+ tslib_1.__decorate([
97
+ (0, di_1.Autowired)(common_1.ITerminalService),
98
+ tslib_1.__metadata("design:type", Object)
99
+ ], TerminalInternalService.prototype, "service", void 0);
100
+ tslib_1.__decorate([
101
+ (0, di_1.Autowired)(common_1.ITerminalController),
102
+ tslib_1.__metadata("design:type", Object)
103
+ ], TerminalInternalService.prototype, "controller", void 0);
104
+ exports.TerminalInternalService = TerminalInternalService = tslib_1.__decorate([
105
+ (0, di_1.Injectable)()
106
+ ], TerminalInternalService);
107
+ //# sourceMappingURL=terminal.internal.service.js.map