@codingame/monaco-vscode-xterm-common 37.2.0 → 37.3.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/package.json +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +39 -39
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +3 -3
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.d.ts +0 -11
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +0 -26
- package/vscode/src/vs/platform/terminal/common/environmentVariable.d.ts +0 -86
- package/vscode/src/vs/platform/terminal/common/environmentVariable.js +0 -10
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.d.ts +0 -17
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +0 -218
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.d.ts +0 -14
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +0 -84
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostOutputChannel.js +0 -48
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.d.ts +0 -129
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostPty.js +0 -439
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.d.ts +0 -77
- package/vscode/src/vs/workbench/contrib/terminal/browser/agentHostTerminalService.js +0 -345
- package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.d.ts +0 -111
- package/vscode/src/vs/workbench/contrib/terminal/browser/ahpTerminalCommandSource.js +0 -138
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.d.ts +0 -28
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +0 -119
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.d.ts +0 -104
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +0 -1643
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +0 -54
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +0 -78
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +0 -144
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +0 -806
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +0 -83
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.d.ts +0 -57
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +0 -139
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +0 -804
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +0 -75
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +0 -61
- package/vscode/src/vs/workbench/contrib/terminal/common/basePty.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/terminal/common/basePty.js +0 -127
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.d.ts +0 -38
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +0 -321
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalStorageKeys.js +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/media/stickyScroll.css +0 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +0 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +0 -58
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +0 -462
|
@@ -1,806 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
-
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
4
|
-
import { Disposable, MutableDisposable, dispose, toDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
6
|
-
import { OS, OperatingSystem, isWindows, isMacintosh } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
|
|
7
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
|
-
import { formatMessageForTerminal } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminalStrings';
|
|
9
|
-
import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
|
|
10
|
-
import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
|
-
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
12
|
-
import { getRemoteAuthority } from '@codingame/monaco-vscode-api/vscode/vs/platform/remote/common/remoteHosts';
|
|
13
|
-
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
14
|
-
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
15
|
-
import { NaiveCwdDetectionCapability } from '../../../../platform/terminal/common/capabilities/naiveCwdDetectionCapability.js';
|
|
16
|
-
import { TerminalCapabilityStore } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/terminalCapabilityStore';
|
|
17
|
-
import { TerminalSettingId, ProcessPropertyType, FlowControlConstants } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal';
|
|
18
|
-
import { ITerminalLogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminal.service';
|
|
19
|
-
import { TerminalRecorder } from '../../../../platform/terminal/common/terminalRecorder.js';
|
|
20
|
-
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
21
|
-
import { EnvironmentVariableInfoChangesActive, EnvironmentVariableInfoStale } from './environmentVariableInfo.js';
|
|
22
|
-
import { ITerminalConfigurationService, ITerminalInstanceService, ITerminalService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal.service';
|
|
23
|
-
import { IEnvironmentVariableService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/environmentVariable.service';
|
|
24
|
-
import { MergedEnvironmentVariableCollection } from '../../../../platform/terminal/common/environmentVariableCollection.js';
|
|
25
|
-
import { serializeEnvironmentVariableCollections } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/environmentVariableShared';
|
|
26
|
-
import { ProcessState } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal';
|
|
27
|
-
import { ITerminalProfileResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal.service';
|
|
28
|
-
import { getWorkspaceForTerminal, mergeEnvironments, createVariableResolver, createTerminalEnvironment, getCwd } from '../common/terminalEnvironment.js';
|
|
29
|
-
import { IConfigurationResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/configurationResolver/common/configurationResolver.service';
|
|
30
|
-
import { IWorkbenchEnvironmentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
31
|
-
import { IHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/history/common/history.service';
|
|
32
|
-
import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
|
|
33
|
-
import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
34
|
-
import { TaskSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/tasks/common/tasks';
|
|
35
|
-
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
36
|
-
import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service';
|
|
37
|
-
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
38
|
-
import { runWhenWindowIdle, getActiveWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
39
|
-
import { mainWindow } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/window';
|
|
40
|
-
import { shouldUseEnvironmentVariableCollection } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/terminalEnvironment';
|
|
41
|
-
import { TerminalContribSettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/terminalContribExports';
|
|
42
|
-
import { IAccessibilityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/common/accessibility.service';
|
|
43
|
-
import { BugIndicatingError } from '@codingame/monaco-vscode-api/vscode/vs/base/common/errors';
|
|
44
|
-
import { isString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
45
|
-
|
|
46
|
-
var ProcessConstants;
|
|
47
|
-
(function(ProcessConstants) {
|
|
48
|
-
ProcessConstants[ProcessConstants["ErrorLaunchThresholdDuration"] = 500] = "ErrorLaunchThresholdDuration";
|
|
49
|
-
ProcessConstants[ProcessConstants["LatencyMeasuringInterval"] = 1000] = "LatencyMeasuringInterval";
|
|
50
|
-
})(ProcessConstants || (ProcessConstants = {}));
|
|
51
|
-
var ProcessType;
|
|
52
|
-
(function(ProcessType) {
|
|
53
|
-
ProcessType[ProcessType["Process"] = 0] = "Process";
|
|
54
|
-
ProcessType[ProcessType["PsuedoTerminal"] = 1] = "PsuedoTerminal";
|
|
55
|
-
})(ProcessType || (ProcessType = {}));
|
|
56
|
-
let TerminalProcessManager = class TerminalProcessManager extends Disposable {
|
|
57
|
-
get persistentProcessId() {
|
|
58
|
-
return this._process?.id;
|
|
59
|
-
}
|
|
60
|
-
get shouldPersist() {
|
|
61
|
-
return !!this.reconnectionProperties || (this._process ? this._process.shouldPersist : false);
|
|
62
|
-
}
|
|
63
|
-
get hasWrittenData() {
|
|
64
|
-
return this._hasWrittenData;
|
|
65
|
-
}
|
|
66
|
-
get hasChildProcesses() {
|
|
67
|
-
return this._hasChildProcesses;
|
|
68
|
-
}
|
|
69
|
-
get reconnectionProperties() {
|
|
70
|
-
return this._shellLaunchConfig?.attachPersistentProcess?.reconnectionProperties || this._shellLaunchConfig?.reconnectionProperties || undefined;
|
|
71
|
-
}
|
|
72
|
-
get extEnvironmentVariableCollection() {
|
|
73
|
-
return this._extEnvironmentVariableCollection;
|
|
74
|
-
}
|
|
75
|
-
get processTraits() {
|
|
76
|
-
return this._processTraits;
|
|
77
|
-
}
|
|
78
|
-
constructor(
|
|
79
|
-
_instanceId,
|
|
80
|
-
cwd,
|
|
81
|
-
environmentVariableCollections,
|
|
82
|
-
shellIntegrationNonce,
|
|
83
|
-
_historyService,
|
|
84
|
-
_instantiationService,
|
|
85
|
-
_logService,
|
|
86
|
-
_workspaceContextService,
|
|
87
|
-
_configurationResolverService,
|
|
88
|
-
_workbenchEnvironmentService,
|
|
89
|
-
_productService,
|
|
90
|
-
_remoteAgentService,
|
|
91
|
-
_pathService,
|
|
92
|
-
_environmentVariableService,
|
|
93
|
-
_terminalConfigurationService,
|
|
94
|
-
_terminalProfileResolverService,
|
|
95
|
-
_configurationService,
|
|
96
|
-
_terminalInstanceService,
|
|
97
|
-
_telemetryService,
|
|
98
|
-
_notificationService,
|
|
99
|
-
_accessibilityService,
|
|
100
|
-
_terminalService
|
|
101
|
-
) {
|
|
102
|
-
super();
|
|
103
|
-
this._instanceId = _instanceId;
|
|
104
|
-
this._historyService = _historyService;
|
|
105
|
-
this._instantiationService = _instantiationService;
|
|
106
|
-
this._logService = _logService;
|
|
107
|
-
this._workspaceContextService = _workspaceContextService;
|
|
108
|
-
this._configurationResolverService = _configurationResolverService;
|
|
109
|
-
this._workbenchEnvironmentService = _workbenchEnvironmentService;
|
|
110
|
-
this._productService = _productService;
|
|
111
|
-
this._remoteAgentService = _remoteAgentService;
|
|
112
|
-
this._pathService = _pathService;
|
|
113
|
-
this._environmentVariableService = _environmentVariableService;
|
|
114
|
-
this._terminalConfigurationService = _terminalConfigurationService;
|
|
115
|
-
this._terminalProfileResolverService = _terminalProfileResolverService;
|
|
116
|
-
this._configurationService = _configurationService;
|
|
117
|
-
this._terminalInstanceService = _terminalInstanceService;
|
|
118
|
-
this._telemetryService = _telemetryService;
|
|
119
|
-
this._notificationService = _notificationService;
|
|
120
|
-
this._accessibilityService = _accessibilityService;
|
|
121
|
-
this._terminalService = _terminalService;
|
|
122
|
-
this.processState = ProcessState.Uninitialized;
|
|
123
|
-
this.capabilities = this._register(( new TerminalCapabilityStore()));
|
|
124
|
-
this.processReadyTimestamp = 0;
|
|
125
|
-
this._isDisposed = false;
|
|
126
|
-
this._process = null;
|
|
127
|
-
this._processType = ProcessType.Process;
|
|
128
|
-
this._preLaunchInputQueue = [];
|
|
129
|
-
this._environmentVariableCollectionListener = this._register(( new MutableDisposable()));
|
|
130
|
-
this._hasWrittenData = false;
|
|
131
|
-
this._hasChildProcesses = false;
|
|
132
|
-
this._ptyListenersAttached = false;
|
|
133
|
-
this._isDisconnected = false;
|
|
134
|
-
this._dimensions = {
|
|
135
|
-
cols: 0,
|
|
136
|
-
rows: 0
|
|
137
|
-
};
|
|
138
|
-
this._onPtyDisconnect = this._register(( new Emitter()));
|
|
139
|
-
this.onPtyDisconnect = this._onPtyDisconnect.event;
|
|
140
|
-
this._onPtyReconnect = this._register(( new Emitter()));
|
|
141
|
-
this.onPtyReconnect = this._onPtyReconnect.event;
|
|
142
|
-
this._onProcessReady = this._register(( new Emitter()));
|
|
143
|
-
this.onProcessReady = this._onProcessReady.event;
|
|
144
|
-
this._onProcessStateChange = this._register(( new Emitter()));
|
|
145
|
-
this.onProcessStateChange = this._onProcessStateChange.event;
|
|
146
|
-
this._onBeforeProcessData = this._register(( new Emitter()));
|
|
147
|
-
this.onBeforeProcessData = this._onBeforeProcessData.event;
|
|
148
|
-
this._onProcessData = this._register(( new Emitter()));
|
|
149
|
-
this.onProcessData = this._onProcessData.event;
|
|
150
|
-
this._onProcessReplayComplete = this._register(( new Emitter()));
|
|
151
|
-
this.onProcessReplayComplete = this._onProcessReplayComplete.event;
|
|
152
|
-
this._onDidChangeProperty = this._register(( new Emitter()));
|
|
153
|
-
this.onDidChangeProperty = this._onDidChangeProperty.event;
|
|
154
|
-
this._onEnvironmentVariableInfoChange = this._register(( new Emitter()));
|
|
155
|
-
this.onEnvironmentVariableInfoChanged = this._onEnvironmentVariableInfoChange.event;
|
|
156
|
-
this._onProcessExit = this._register(( new Emitter()));
|
|
157
|
-
this.onProcessExit = this._onProcessExit.event;
|
|
158
|
-
this._onRestoreCommands = this._register(( new Emitter()));
|
|
159
|
-
this.onRestoreCommands = this._onRestoreCommands.event;
|
|
160
|
-
this._cwdWorkspaceFolder = getWorkspaceForTerminal(cwd, this._workspaceContextService, this._historyService);
|
|
161
|
-
this.ptyProcessReady = this._createPtyProcessReadyPromise();
|
|
162
|
-
this._ackDataBufferer = ( new AckDataBufferer(e => this._process?.acknowledgeDataEvent(e)));
|
|
163
|
-
this._dataFilter = this._register(this._instantiationService.createInstance(SeamlessRelaunchDataFilter));
|
|
164
|
-
this._register(this._dataFilter.onProcessData(ev => {
|
|
165
|
-
const data = (isString(ev) ? ev : ev.data);
|
|
166
|
-
const beforeProcessDataEvent = {
|
|
167
|
-
data
|
|
168
|
-
};
|
|
169
|
-
this._onBeforeProcessData.fire(beforeProcessDataEvent);
|
|
170
|
-
if (beforeProcessDataEvent.data && beforeProcessDataEvent.data.length > 0) {
|
|
171
|
-
if (!isString(ev)) {
|
|
172
|
-
ev.data = beforeProcessDataEvent.data;
|
|
173
|
-
}
|
|
174
|
-
this._onProcessData.fire(!isString(ev) ? ev : {
|
|
175
|
-
data: beforeProcessDataEvent.data,
|
|
176
|
-
trackCommit: false
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
}));
|
|
180
|
-
if (cwd && typeof cwd === "object") {
|
|
181
|
-
this.remoteAuthority = getRemoteAuthority(cwd);
|
|
182
|
-
} else {
|
|
183
|
-
this.remoteAuthority = this._workbenchEnvironmentService.remoteAuthority;
|
|
184
|
-
}
|
|
185
|
-
if (environmentVariableCollections) {
|
|
186
|
-
this._extEnvironmentVariableCollection = ( new MergedEnvironmentVariableCollection(environmentVariableCollections));
|
|
187
|
-
this._environmentVariableCollectionListener.value = this._environmentVariableService.onDidChangeCollections(
|
|
188
|
-
newCollection => this._onEnvironmentVariableCollectionChange(newCollection)
|
|
189
|
-
);
|
|
190
|
-
this.environmentVariableInfo = this._instantiationService.createInstance(
|
|
191
|
-
EnvironmentVariableInfoChangesActive,
|
|
192
|
-
this._extEnvironmentVariableCollection
|
|
193
|
-
);
|
|
194
|
-
this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo);
|
|
195
|
-
}
|
|
196
|
-
this.shellIntegrationNonce = shellIntegrationNonce ?? generateUuid();
|
|
197
|
-
}
|
|
198
|
-
async freePortKillProcess(port) {
|
|
199
|
-
try {
|
|
200
|
-
if (this._process?.freePortKillProcess) {
|
|
201
|
-
await this._process?.freePortKillProcess(port);
|
|
202
|
-
}
|
|
203
|
-
} catch (e) {
|
|
204
|
-
this._notificationService.notify({
|
|
205
|
-
message: ( localize(
|
|
206
|
-
16956,
|
|
207
|
-
"Could not kill process listening on port {0}, command exited with error {1}",
|
|
208
|
-
port,
|
|
209
|
-
e
|
|
210
|
-
)),
|
|
211
|
-
severity: Severity.Warning
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
dispose(immediate = false) {
|
|
216
|
-
this._isDisposed = true;
|
|
217
|
-
if (this._process) {
|
|
218
|
-
this._setProcessState(ProcessState.KilledByUser);
|
|
219
|
-
this._process.shutdown(immediate);
|
|
220
|
-
this._process = null;
|
|
221
|
-
}
|
|
222
|
-
if (this._processListeners) {
|
|
223
|
-
dispose(this._processListeners);
|
|
224
|
-
this._processListeners = undefined;
|
|
225
|
-
}
|
|
226
|
-
super.dispose();
|
|
227
|
-
}
|
|
228
|
-
_createPtyProcessReadyPromise() {
|
|
229
|
-
return ( new Promise(c => {
|
|
230
|
-
const listener = Event.once(this.onProcessReady)(() => {
|
|
231
|
-
this._logService.debug(`Terminal process ready (shellProcessId: ${this.shellProcessId})`);
|
|
232
|
-
this._store.delete(listener);
|
|
233
|
-
c(undefined);
|
|
234
|
-
});
|
|
235
|
-
this._store.add(listener);
|
|
236
|
-
}));
|
|
237
|
-
}
|
|
238
|
-
async detachFromProcess(forcePersist) {
|
|
239
|
-
await this._process?.detach?.(forcePersist);
|
|
240
|
-
this._process = null;
|
|
241
|
-
}
|
|
242
|
-
async createProcess(shellLaunchConfig, cols, rows, reset = true) {
|
|
243
|
-
this._shellLaunchConfig = shellLaunchConfig;
|
|
244
|
-
this._dimensions.cols = cols;
|
|
245
|
-
this._dimensions.rows = rows;
|
|
246
|
-
let newProcess;
|
|
247
|
-
if (shellLaunchConfig.customPtyImplementation) {
|
|
248
|
-
this._processType = ProcessType.PsuedoTerminal;
|
|
249
|
-
newProcess = shellLaunchConfig.customPtyImplementation(this._instanceId, cols, rows);
|
|
250
|
-
} else {
|
|
251
|
-
const backend = await this._terminalInstanceService.getBackend(this.remoteAuthority);
|
|
252
|
-
if (!backend) {
|
|
253
|
-
throw ( new Error(
|
|
254
|
-
`No terminal backend registered for remote authority '${this.remoteAuthority}'`
|
|
255
|
-
));
|
|
256
|
-
}
|
|
257
|
-
this.backend = backend;
|
|
258
|
-
const envForResolver = {
|
|
259
|
-
...(await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority))
|
|
260
|
-
};
|
|
261
|
-
mergeEnvironments(envForResolver, await backend.getShellEnvironment());
|
|
262
|
-
const variableResolver = createVariableResolver(
|
|
263
|
-
this._cwdWorkspaceFolder,
|
|
264
|
-
envForResolver,
|
|
265
|
-
this._configurationResolverService
|
|
266
|
-
);
|
|
267
|
-
this.userHome = this._pathService.resolvedUserHome?.fsPath;
|
|
268
|
-
this.os = OS;
|
|
269
|
-
if (!!this.remoteAuthority) {
|
|
270
|
-
const userHomeUri = await this._pathService.userHome();
|
|
271
|
-
this.userHome = userHomeUri.path;
|
|
272
|
-
const remoteEnv = await this._remoteAgentService.getEnvironment();
|
|
273
|
-
if (!remoteEnv) {
|
|
274
|
-
throw ( new Error(
|
|
275
|
-
`Failed to get remote environment for remote authority "${this.remoteAuthority}"`
|
|
276
|
-
));
|
|
277
|
-
}
|
|
278
|
-
this.userHome = remoteEnv.userHome.path;
|
|
279
|
-
this.os = remoteEnv.os;
|
|
280
|
-
const env = await this._resolveEnvironment(backend, variableResolver, shellLaunchConfig);
|
|
281
|
-
const shouldPersist = ((this._configurationService.getValue(TaskSettingId.Reconnection) && shellLaunchConfig.reconnectionProperties) || !shellLaunchConfig.isFeatureTerminal) && this._terminalConfigurationService.config.enablePersistentSessions && !shellLaunchConfig.isTransient;
|
|
282
|
-
if (shellLaunchConfig.attachPersistentProcess) {
|
|
283
|
-
const result = await backend.attachToProcess(shellLaunchConfig.attachPersistentProcess.id);
|
|
284
|
-
if (result) {
|
|
285
|
-
newProcess = result;
|
|
286
|
-
} else {
|
|
287
|
-
this._logService.warn(
|
|
288
|
-
`Attach to process failed for terminal`,
|
|
289
|
-
shellLaunchConfig.attachPersistentProcess
|
|
290
|
-
);
|
|
291
|
-
shellLaunchConfig.attachPersistentProcess = undefined;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
if (!newProcess) {
|
|
295
|
-
await this._terminalProfileResolverService.resolveShellLaunchConfig(shellLaunchConfig, {
|
|
296
|
-
remoteAuthority: this.remoteAuthority,
|
|
297
|
-
os: this.os
|
|
298
|
-
});
|
|
299
|
-
const options = {
|
|
300
|
-
shellIntegration: {
|
|
301
|
-
enabled: this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled),
|
|
302
|
-
suggestEnabled: this._configurationService.getValue(TerminalContribSettingId.SuggestEnabled),
|
|
303
|
-
nonce: this.shellIntegrationNonce
|
|
304
|
-
},
|
|
305
|
-
windowsUseConptyDll: this._terminalConfigurationService.config.windowsUseConptyDll ?? false,
|
|
306
|
-
environmentVariableCollections: this._extEnvironmentVariableCollection?.collections ? serializeEnvironmentVariableCollections(this._extEnvironmentVariableCollection.collections) : undefined,
|
|
307
|
-
workspaceFolder: this._cwdWorkspaceFolder,
|
|
308
|
-
isScreenReaderOptimized: this._accessibilityService.isScreenReaderOptimized()
|
|
309
|
-
};
|
|
310
|
-
try {
|
|
311
|
-
newProcess = await backend.createProcess(shellLaunchConfig, "",
|
|
312
|
-
cols, rows, this._terminalConfigurationService.config.unicodeVersion, env,
|
|
313
|
-
options, shouldPersist);
|
|
314
|
-
} catch (e) {
|
|
315
|
-
if (e?.message === "Could not fetch remote environment") {
|
|
316
|
-
this._logService.trace(`Could not fetch remote environment, silently failing`);
|
|
317
|
-
return undefined;
|
|
318
|
-
}
|
|
319
|
-
throw e;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
if (!this._isDisposed) {
|
|
323
|
-
this._setupPtyHostListeners(backend);
|
|
324
|
-
}
|
|
325
|
-
} else {
|
|
326
|
-
if (shellLaunchConfig.attachPersistentProcess) {
|
|
327
|
-
const result = shellLaunchConfig.attachPersistentProcess.findRevivedId ? await backend.attachToRevivedProcess(shellLaunchConfig.attachPersistentProcess.id) : await backend.attachToProcess(shellLaunchConfig.attachPersistentProcess.id);
|
|
328
|
-
if (result) {
|
|
329
|
-
newProcess = result;
|
|
330
|
-
} else {
|
|
331
|
-
this._logService.warn(
|
|
332
|
-
`Attach to process failed for terminal`,
|
|
333
|
-
shellLaunchConfig.attachPersistentProcess
|
|
334
|
-
);
|
|
335
|
-
shellLaunchConfig.attachPersistentProcess = undefined;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
if (!newProcess) {
|
|
339
|
-
newProcess = await this._launchLocalProcess(backend, shellLaunchConfig, cols, rows, this.userHome, variableResolver);
|
|
340
|
-
}
|
|
341
|
-
if (!this._isDisposed) {
|
|
342
|
-
this._setupPtyHostListeners(backend);
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
if (this._isDisposed) {
|
|
347
|
-
newProcess.shutdown(false);
|
|
348
|
-
return undefined;
|
|
349
|
-
}
|
|
350
|
-
this._process = newProcess;
|
|
351
|
-
this._setProcessState(ProcessState.Launching);
|
|
352
|
-
if (this.os === OperatingSystem.Linux || this.os === OperatingSystem.Macintosh) {
|
|
353
|
-
this.capabilities.add(TerminalCapability.NaiveCwdDetection, ( new NaiveCwdDetectionCapability(this._process)));
|
|
354
|
-
}
|
|
355
|
-
this._dataFilter.newProcess(this._process, reset);
|
|
356
|
-
if (this._processListeners) {
|
|
357
|
-
dispose(this._processListeners);
|
|
358
|
-
}
|
|
359
|
-
this._processListeners = [newProcess.onProcessReady(e => {
|
|
360
|
-
this._logService.debug("onProcessReady", e);
|
|
361
|
-
this._processTraits = e;
|
|
362
|
-
this.shellProcessId = e.pid;
|
|
363
|
-
this._initialCwd = e.cwd;
|
|
364
|
-
this.processReadyTimestamp = Date.now();
|
|
365
|
-
this._onDidChangeProperty.fire({
|
|
366
|
-
type: ProcessPropertyType.InitialCwd,
|
|
367
|
-
value: this._initialCwd
|
|
368
|
-
});
|
|
369
|
-
this._onProcessReady.fire(e);
|
|
370
|
-
if (this._preLaunchInputQueue.length > 0 && this._process) {
|
|
371
|
-
this._logService.debug("sending prelaunch input queue", this._preLaunchInputQueue);
|
|
372
|
-
newProcess.input(this._preLaunchInputQueue.join(""));
|
|
373
|
-
this._preLaunchInputQueue.length = 0;
|
|
374
|
-
}
|
|
375
|
-
}), newProcess.onProcessExit(exitCode => this._onExit(exitCode)), newProcess.onDidChangeProperty((
|
|
376
|
-
{
|
|
377
|
-
type,
|
|
378
|
-
value
|
|
379
|
-
}
|
|
380
|
-
) => {
|
|
381
|
-
switch (type) {
|
|
382
|
-
case ProcessPropertyType.HasChildProcesses:
|
|
383
|
-
this._hasChildProcesses = value;
|
|
384
|
-
break;
|
|
385
|
-
case ProcessPropertyType.FailedShellIntegrationActivation:
|
|
386
|
-
this._telemetryService?.publicLog2("terminal/shellIntegrationActivationFailureCustomArgs");
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
this._onDidChangeProperty.fire({
|
|
390
|
-
type,
|
|
391
|
-
value
|
|
392
|
-
});
|
|
393
|
-
})];
|
|
394
|
-
if (newProcess.onProcessReplayComplete) {
|
|
395
|
-
this._processListeners.push(
|
|
396
|
-
newProcess.onProcessReplayComplete(() => this._onProcessReplayComplete.fire())
|
|
397
|
-
);
|
|
398
|
-
}
|
|
399
|
-
if (newProcess.onRestoreCommands) {
|
|
400
|
-
this._processListeners.push(newProcess.onRestoreCommands(e => this._onRestoreCommands.fire(e)));
|
|
401
|
-
}
|
|
402
|
-
setTimeout(() => {
|
|
403
|
-
if (this.processState === ProcessState.Launching) {
|
|
404
|
-
this._setProcessState(ProcessState.Running);
|
|
405
|
-
}
|
|
406
|
-
}, ProcessConstants.ErrorLaunchThresholdDuration);
|
|
407
|
-
const result = await newProcess.start();
|
|
408
|
-
if (result) {
|
|
409
|
-
return result;
|
|
410
|
-
}
|
|
411
|
-
runWhenWindowIdle(getActiveWindow(), () => {
|
|
412
|
-
this.backend?.getLatency().then(measurements => {
|
|
413
|
-
this._logService.info(
|
|
414
|
-
`Latency measurements for ${this.remoteAuthority ?? "local"} backend\n${( measurements.map(e => `${e.label}: ${e.latency.toFixed(2)}ms`)).join("\n")}`
|
|
415
|
-
);
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
return undefined;
|
|
419
|
-
}
|
|
420
|
-
async relaunch(shellLaunchConfig, cols, rows, reset) {
|
|
421
|
-
this.ptyProcessReady = this._createPtyProcessReadyPromise();
|
|
422
|
-
this._logService.trace(`Relaunching terminal instance ${this._instanceId}`);
|
|
423
|
-
if (this._isDisconnected) {
|
|
424
|
-
this._isDisconnected = false;
|
|
425
|
-
this._onPtyReconnect.fire();
|
|
426
|
-
}
|
|
427
|
-
this._hasWrittenData = false;
|
|
428
|
-
return this.createProcess(shellLaunchConfig, cols, rows, reset);
|
|
429
|
-
}
|
|
430
|
-
async _resolveEnvironment(backend, variableResolver, shellLaunchConfig) {
|
|
431
|
-
const workspaceFolder = getWorkspaceForTerminal(shellLaunchConfig.cwd, this._workspaceContextService, this._historyService);
|
|
432
|
-
const platformKey = isWindows ? "windows" : (isMacintosh ? "osx" : "linux");
|
|
433
|
-
const envFromConfigValue = this._configurationService.getValue(`terminal.integrated.env.${platformKey}`);
|
|
434
|
-
this._logService.debug(
|
|
435
|
-
`Resolving environment (useShellEnvironment=${shellLaunchConfig.useShellEnvironment}, platformKey=${platformKey}, envFromConfig=${envFromConfigValue ? ( Object.keys(envFromConfigValue)).join(",") : "none"})`
|
|
436
|
-
);
|
|
437
|
-
let baseEnv;
|
|
438
|
-
if (shellLaunchConfig.useShellEnvironment) {
|
|
439
|
-
const shellEnv = await backend.getShellEnvironment();
|
|
440
|
-
if (!shellEnv) {
|
|
441
|
-
throw ( new BugIndicatingError("Cannot fetch shell environment to use"));
|
|
442
|
-
}
|
|
443
|
-
this._logService.debug(`Shell environment resolved with ${( Object.keys(shellEnv)).length} variables: ${( Object.keys(shellEnv)).sort().join(", ")}`);
|
|
444
|
-
baseEnv = shellEnv;
|
|
445
|
-
} else {
|
|
446
|
-
baseEnv = await this._terminalProfileResolverService.getEnvironment(this.remoteAuthority);
|
|
447
|
-
this._logService.debug(`Profile environment resolved with ${( Object.keys(baseEnv)).length} variables`);
|
|
448
|
-
}
|
|
449
|
-
const env = await createTerminalEnvironment(
|
|
450
|
-
shellLaunchConfig,
|
|
451
|
-
envFromConfigValue,
|
|
452
|
-
variableResolver,
|
|
453
|
-
this._productService.version,
|
|
454
|
-
this._terminalConfigurationService.config.detectLocale,
|
|
455
|
-
baseEnv
|
|
456
|
-
);
|
|
457
|
-
this._logService.debug(`Terminal environment created with ${( Object.keys(env)).length} variables: ${( Object.keys(env)).sort().join(", ")}`);
|
|
458
|
-
this._environmentVariableCollectionListener.clear();
|
|
459
|
-
if (!this._isDisposed && shouldUseEnvironmentVariableCollection(shellLaunchConfig)) {
|
|
460
|
-
this._extEnvironmentVariableCollection = this._environmentVariableService.mergedCollection;
|
|
461
|
-
this._environmentVariableCollectionListener.value = this._environmentVariableService.onDidChangeCollections(
|
|
462
|
-
newCollection => this._onEnvironmentVariableCollectionChange(newCollection)
|
|
463
|
-
);
|
|
464
|
-
await this._extEnvironmentVariableCollection.applyToProcessEnvironment(env, {
|
|
465
|
-
workspaceFolder
|
|
466
|
-
}, variableResolver);
|
|
467
|
-
if (this._extEnvironmentVariableCollection.getVariableMap({
|
|
468
|
-
workspaceFolder
|
|
469
|
-
}).size) {
|
|
470
|
-
this.environmentVariableInfo = this._instantiationService.createInstance(
|
|
471
|
-
EnvironmentVariableInfoChangesActive,
|
|
472
|
-
this._extEnvironmentVariableCollection
|
|
473
|
-
);
|
|
474
|
-
this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
return env;
|
|
478
|
-
}
|
|
479
|
-
async _launchLocalProcess(backend, shellLaunchConfig, cols, rows, userHome, variableResolver) {
|
|
480
|
-
await this._terminalProfileResolverService.resolveShellLaunchConfig(shellLaunchConfig, {
|
|
481
|
-
remoteAuthority: undefined,
|
|
482
|
-
os: OS
|
|
483
|
-
});
|
|
484
|
-
const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(Schemas.file);
|
|
485
|
-
const initialCwd = await getCwd(
|
|
486
|
-
shellLaunchConfig,
|
|
487
|
-
userHome,
|
|
488
|
-
variableResolver,
|
|
489
|
-
activeWorkspaceRootUri,
|
|
490
|
-
this._terminalConfigurationService.config.cwd,
|
|
491
|
-
this._logService
|
|
492
|
-
);
|
|
493
|
-
const env = await this._resolveEnvironment(backend, variableResolver, shellLaunchConfig);
|
|
494
|
-
const options = {
|
|
495
|
-
shellIntegration: {
|
|
496
|
-
enabled: this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled),
|
|
497
|
-
suggestEnabled: this._configurationService.getValue(TerminalContribSettingId.SuggestEnabled),
|
|
498
|
-
nonce: this.shellIntegrationNonce
|
|
499
|
-
},
|
|
500
|
-
windowsUseConptyDll: this._terminalConfigurationService.config.windowsUseConptyDll ?? false,
|
|
501
|
-
environmentVariableCollections: this._extEnvironmentVariableCollection ? serializeEnvironmentVariableCollections(this._extEnvironmentVariableCollection.collections) : undefined,
|
|
502
|
-
workspaceFolder: this._cwdWorkspaceFolder,
|
|
503
|
-
isScreenReaderOptimized: this._accessibilityService.isScreenReaderOptimized()
|
|
504
|
-
};
|
|
505
|
-
const shouldPersist = ((this._configurationService.getValue(TaskSettingId.Reconnection) && shellLaunchConfig.reconnectionProperties) || !shellLaunchConfig.isFeatureTerminal) && this._terminalConfigurationService.config.enablePersistentSessions && !shellLaunchConfig.isTransient;
|
|
506
|
-
return await backend.createProcess(
|
|
507
|
-
shellLaunchConfig,
|
|
508
|
-
initialCwd,
|
|
509
|
-
cols,
|
|
510
|
-
rows,
|
|
511
|
-
this._terminalConfigurationService.config.unicodeVersion,
|
|
512
|
-
env,
|
|
513
|
-
options,
|
|
514
|
-
shouldPersist
|
|
515
|
-
);
|
|
516
|
-
}
|
|
517
|
-
_setupPtyHostListeners(backend) {
|
|
518
|
-
if (this._ptyListenersAttached) {
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
this._ptyListenersAttached = true;
|
|
522
|
-
this._register(backend.onPtyHostUnresponsive(() => {
|
|
523
|
-
this._isDisconnected = true;
|
|
524
|
-
this._onPtyDisconnect.fire();
|
|
525
|
-
}));
|
|
526
|
-
this._ptyResponsiveListener = backend.onPtyHostResponsive(() => {
|
|
527
|
-
this._isDisconnected = false;
|
|
528
|
-
this._onPtyReconnect.fire();
|
|
529
|
-
});
|
|
530
|
-
this._register(toDisposable(() => this._ptyResponsiveListener?.dispose()));
|
|
531
|
-
this._register(backend.onPtyHostRestart(async () => {
|
|
532
|
-
if (!this._isDisconnected) {
|
|
533
|
-
this._isDisconnected = true;
|
|
534
|
-
this._onPtyDisconnect.fire();
|
|
535
|
-
}
|
|
536
|
-
this._ptyResponsiveListener?.dispose();
|
|
537
|
-
this._ptyResponsiveListener = undefined;
|
|
538
|
-
if (this._shellLaunchConfig) {
|
|
539
|
-
if (this._shellLaunchConfig.isFeatureTerminal && !this.reconnectionProperties) {
|
|
540
|
-
this._onExit(-1);
|
|
541
|
-
} else {
|
|
542
|
-
const message = ( localize(
|
|
543
|
-
16957,
|
|
544
|
-
"Restarting the terminal because the connection to the shell process was lost..."
|
|
545
|
-
));
|
|
546
|
-
let postRestartMessage = "";
|
|
547
|
-
if (this.os === OperatingSystem.Windows && this._dimensions.rows > 0) {
|
|
548
|
-
postRestartMessage = "\r\n".repeat(this._dimensions.rows - 1) + `\x1b[H`;
|
|
549
|
-
}
|
|
550
|
-
this._onProcessData.fire({
|
|
551
|
-
data: formatMessageForTerminal(message, {
|
|
552
|
-
loudFormatting: true
|
|
553
|
-
}) + postRestartMessage,
|
|
554
|
-
trackCommit: false
|
|
555
|
-
});
|
|
556
|
-
await this.relaunch(
|
|
557
|
-
this._shellLaunchConfig,
|
|
558
|
-
this._dimensions.cols,
|
|
559
|
-
this._dimensions.rows,
|
|
560
|
-
false
|
|
561
|
-
);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}));
|
|
565
|
-
this._register(toDisposable(() => {
|
|
566
|
-
this.ptyProcessReady = undefined;
|
|
567
|
-
}));
|
|
568
|
-
}
|
|
569
|
-
async getBackendOS() {
|
|
570
|
-
let os = OS;
|
|
571
|
-
if (!!this.remoteAuthority) {
|
|
572
|
-
const remoteEnv = await this._remoteAgentService.getEnvironment();
|
|
573
|
-
if (!remoteEnv) {
|
|
574
|
-
throw ( new Error(
|
|
575
|
-
`Failed to get remote environment for remote authority "${this.remoteAuthority}"`
|
|
576
|
-
));
|
|
577
|
-
}
|
|
578
|
-
os = remoteEnv.os;
|
|
579
|
-
}
|
|
580
|
-
return os;
|
|
581
|
-
}
|
|
582
|
-
setDimensions(cols, rows, sync, pixelWidth, pixelHeight) {
|
|
583
|
-
if (sync) {
|
|
584
|
-
this._resize(cols, rows, pixelWidth, pixelHeight);
|
|
585
|
-
return;
|
|
586
|
-
}
|
|
587
|
-
if (this._store.isDisposed) {
|
|
588
|
-
return Promise.resolve();
|
|
589
|
-
}
|
|
590
|
-
if (!this.ptyProcessReady) {
|
|
591
|
-
throw ( new Error("TerminalProcessManager.setDimensions called before initialization"));
|
|
592
|
-
}
|
|
593
|
-
return this.ptyProcessReady.then(() => this._resize(cols, rows, pixelWidth, pixelHeight));
|
|
594
|
-
}
|
|
595
|
-
async setUnicodeVersion(version) {
|
|
596
|
-
return this._process?.setUnicodeVersion(version);
|
|
597
|
-
}
|
|
598
|
-
async setNextCommandId(commandLine, commandId) {
|
|
599
|
-
await this.ptyProcessReady;
|
|
600
|
-
const process = this._process;
|
|
601
|
-
if (!process?.id) {
|
|
602
|
-
return;
|
|
603
|
-
}
|
|
604
|
-
await this._terminalService.setNextCommandId(process.id, commandLine, commandId);
|
|
605
|
-
}
|
|
606
|
-
_resize(cols, rows, pixelWidth, pixelHeight) {
|
|
607
|
-
if (!this._process) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
try {
|
|
611
|
-
this._process.resize(cols, rows, pixelWidth, pixelHeight);
|
|
612
|
-
} catch (error) {
|
|
613
|
-
if (error.code !== "EPIPE" && error.code !== "ERR_IPC_CHANNEL_CLOSED") {
|
|
614
|
-
throw error;
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
this._dimensions.cols = cols;
|
|
618
|
-
this._dimensions.rows = rows;
|
|
619
|
-
}
|
|
620
|
-
async write(data) {
|
|
621
|
-
await this.ptyProcessReady;
|
|
622
|
-
this._dataFilter.disableSeamlessRelaunch();
|
|
623
|
-
this._hasWrittenData = true;
|
|
624
|
-
if (this.shellProcessId || this._processType === ProcessType.PsuedoTerminal) {
|
|
625
|
-
if (this._process) {
|
|
626
|
-
this._process.input(data);
|
|
627
|
-
}
|
|
628
|
-
} else {
|
|
629
|
-
this._logService.debug("queueing data in prelaunch input queue", data);
|
|
630
|
-
this._preLaunchInputQueue.push(data);
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
async sendSignal(signal) {
|
|
634
|
-
await this.ptyProcessReady;
|
|
635
|
-
if (this._process) {
|
|
636
|
-
this._process.sendSignal(signal);
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
async processBinary(data) {
|
|
640
|
-
await this.ptyProcessReady;
|
|
641
|
-
this._dataFilter.disableSeamlessRelaunch();
|
|
642
|
-
this._hasWrittenData = true;
|
|
643
|
-
this._process?.processBinary(data);
|
|
644
|
-
}
|
|
645
|
-
get initialCwd() {
|
|
646
|
-
return this._initialCwd ?? "";
|
|
647
|
-
}
|
|
648
|
-
async refreshProperty(type) {
|
|
649
|
-
if (!this._process) {
|
|
650
|
-
throw ( new Error("Cannot refresh property when process is not set"));
|
|
651
|
-
}
|
|
652
|
-
return this._process.refreshProperty(type);
|
|
653
|
-
}
|
|
654
|
-
async updateProperty(type, value) {
|
|
655
|
-
return this._process?.updateProperty(type, value);
|
|
656
|
-
}
|
|
657
|
-
acknowledgeDataEvent(charCount) {
|
|
658
|
-
this._ackDataBufferer.ack(charCount);
|
|
659
|
-
}
|
|
660
|
-
_onExit(exitCode) {
|
|
661
|
-
this._process = null;
|
|
662
|
-
if (this.processState === ProcessState.Launching) {
|
|
663
|
-
this._setProcessState(ProcessState.KilledDuringLaunch);
|
|
664
|
-
}
|
|
665
|
-
if (this.processState === ProcessState.Running) {
|
|
666
|
-
this._setProcessState(ProcessState.KilledByProcess);
|
|
667
|
-
}
|
|
668
|
-
this._onProcessExit.fire(exitCode);
|
|
669
|
-
}
|
|
670
|
-
_setProcessState(state) {
|
|
671
|
-
this.processState = state;
|
|
672
|
-
this._onProcessStateChange.fire();
|
|
673
|
-
}
|
|
674
|
-
_onEnvironmentVariableCollectionChange(newCollection) {
|
|
675
|
-
const diff = this._extEnvironmentVariableCollection.diff(newCollection, {
|
|
676
|
-
workspaceFolder: this._cwdWorkspaceFolder
|
|
677
|
-
});
|
|
678
|
-
if (diff === undefined) {
|
|
679
|
-
if (this.environmentVariableInfo instanceof EnvironmentVariableInfoStale) {
|
|
680
|
-
this.environmentVariableInfo = this._instantiationService.createInstance(
|
|
681
|
-
EnvironmentVariableInfoChangesActive,
|
|
682
|
-
this._extEnvironmentVariableCollection
|
|
683
|
-
);
|
|
684
|
-
this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo);
|
|
685
|
-
}
|
|
686
|
-
return;
|
|
687
|
-
}
|
|
688
|
-
this.environmentVariableInfo = this._instantiationService.createInstance(EnvironmentVariableInfoStale, diff, this._instanceId, newCollection);
|
|
689
|
-
this._onEnvironmentVariableInfoChange.fire(this.environmentVariableInfo);
|
|
690
|
-
}
|
|
691
|
-
async clearBuffer() {
|
|
692
|
-
this._process?.clearBuffer?.();
|
|
693
|
-
}
|
|
694
|
-
};
|
|
695
|
-
TerminalProcessManager = ( __decorate([( __param(4, IHistoryService)), ( __param(5, IInstantiationService)), ( __param(6, ITerminalLogService)), ( __param(7, IWorkspaceContextService)), ( __param(8, IConfigurationResolverService)), ( __param(9, IWorkbenchEnvironmentService)), ( __param(10, IProductService)), ( __param(11, IRemoteAgentService)), ( __param(12, IPathService)), ( __param(13, IEnvironmentVariableService)), ( __param(14, ITerminalConfigurationService)), ( __param(15, ITerminalProfileResolverService)), ( __param(16, IConfigurationService)), ( __param(17, ITerminalInstanceService)), ( __param(18, ITelemetryService)), ( __param(19, INotificationService)), ( __param(20, IAccessibilityService)), ( __param(21, ITerminalService))], TerminalProcessManager));
|
|
696
|
-
class AckDataBufferer {
|
|
697
|
-
constructor(_callback) {
|
|
698
|
-
this._callback = _callback;
|
|
699
|
-
this._unsentCharCount = 0;
|
|
700
|
-
}
|
|
701
|
-
ack(charCount) {
|
|
702
|
-
this._unsentCharCount += charCount;
|
|
703
|
-
while (this._unsentCharCount > FlowControlConstants.CharCountAckSize) {
|
|
704
|
-
this._unsentCharCount -= FlowControlConstants.CharCountAckSize;
|
|
705
|
-
this._callback(FlowControlConstants.CharCountAckSize);
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
var SeamlessRelaunchConstants;
|
|
710
|
-
(function(SeamlessRelaunchConstants) {
|
|
711
|
-
SeamlessRelaunchConstants[SeamlessRelaunchConstants["RecordTerminalDuration"] = 10000] = "RecordTerminalDuration";
|
|
712
|
-
SeamlessRelaunchConstants[SeamlessRelaunchConstants["SwapWaitMaximumDuration"] = 3000] = "SwapWaitMaximumDuration";
|
|
713
|
-
})(SeamlessRelaunchConstants || (SeamlessRelaunchConstants = {}));
|
|
714
|
-
let SeamlessRelaunchDataFilter = class SeamlessRelaunchDataFilter extends Disposable {
|
|
715
|
-
get onProcessData() {
|
|
716
|
-
return this._onProcessData.event;
|
|
717
|
-
}
|
|
718
|
-
constructor(_logService) {
|
|
719
|
-
super();
|
|
720
|
-
this._logService = _logService;
|
|
721
|
-
this._firstDisposable = this._register(( new MutableDisposable()));
|
|
722
|
-
this._secondDisposable = this._register(( new MutableDisposable()));
|
|
723
|
-
this._dataListener = this._register(( new MutableDisposable()));
|
|
724
|
-
this._disableSeamlessRelaunch = false;
|
|
725
|
-
this._onProcessData = this._register(( new Emitter()));
|
|
726
|
-
}
|
|
727
|
-
newProcess(process, reset) {
|
|
728
|
-
this._dataListener.clear();
|
|
729
|
-
this._activeProcess?.shutdown(false);
|
|
730
|
-
this._activeProcess = process;
|
|
731
|
-
if (!this._firstRecorder || !reset || this._disableSeamlessRelaunch) {
|
|
732
|
-
[this._firstRecorder, this._firstDisposable.value] = this._createRecorder(process);
|
|
733
|
-
if (this._disableSeamlessRelaunch && reset) {
|
|
734
|
-
this._onProcessData.fire("\u001bc");
|
|
735
|
-
}
|
|
736
|
-
this._dataListener.value = process.onProcessData(e => this._onProcessData.fire(e));
|
|
737
|
-
this._disableSeamlessRelaunch = false;
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
if (this._secondRecorder) {
|
|
741
|
-
this.triggerSwap();
|
|
742
|
-
}
|
|
743
|
-
this._swapTimeout = mainWindow.setTimeout(
|
|
744
|
-
() => this.triggerSwap(),
|
|
745
|
-
SeamlessRelaunchConstants.SwapWaitMaximumDuration
|
|
746
|
-
);
|
|
747
|
-
this._dataListener.clear();
|
|
748
|
-
this._firstDisposable.clear();
|
|
749
|
-
const recorder = this._createRecorder(process);
|
|
750
|
-
[this._secondRecorder, this._secondDisposable.value] = recorder;
|
|
751
|
-
}
|
|
752
|
-
disableSeamlessRelaunch() {
|
|
753
|
-
this._disableSeamlessRelaunch = true;
|
|
754
|
-
this._stopRecording();
|
|
755
|
-
this.triggerSwap();
|
|
756
|
-
}
|
|
757
|
-
triggerSwap() {
|
|
758
|
-
if (this._swapTimeout) {
|
|
759
|
-
mainWindow.clearTimeout(this._swapTimeout);
|
|
760
|
-
this._swapTimeout = undefined;
|
|
761
|
-
}
|
|
762
|
-
if (!this._firstRecorder) {
|
|
763
|
-
return;
|
|
764
|
-
}
|
|
765
|
-
if (!this._secondRecorder) {
|
|
766
|
-
this._firstRecorder = undefined;
|
|
767
|
-
this._firstDisposable.clear();
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
const firstData = this._getDataFromRecorder(this._firstRecorder);
|
|
771
|
-
const secondData = this._getDataFromRecorder(this._secondRecorder);
|
|
772
|
-
if (firstData === secondData) {
|
|
773
|
-
this._logService.trace(`Seamless terminal relaunch - identical content`);
|
|
774
|
-
} else {
|
|
775
|
-
this._logService.trace(`Seamless terminal relaunch - resetting content`);
|
|
776
|
-
this._onProcessData.fire({
|
|
777
|
-
data: `\x1bc${secondData}`,
|
|
778
|
-
trackCommit: false
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
this._dataListener.value = this._activeProcess.onProcessData(e => this._onProcessData.fire(e));
|
|
782
|
-
this._firstRecorder = this._secondRecorder;
|
|
783
|
-
this._firstDisposable.value = this._secondDisposable.value;
|
|
784
|
-
this._secondRecorder = undefined;
|
|
785
|
-
}
|
|
786
|
-
_stopRecording() {
|
|
787
|
-
if (this._swapTimeout) {
|
|
788
|
-
return;
|
|
789
|
-
}
|
|
790
|
-
this._firstRecorder = undefined;
|
|
791
|
-
this._firstDisposable.clear();
|
|
792
|
-
this._secondRecorder = undefined;
|
|
793
|
-
this._secondDisposable.clear();
|
|
794
|
-
}
|
|
795
|
-
_createRecorder(process) {
|
|
796
|
-
const recorder = ( new TerminalRecorder(0, 0));
|
|
797
|
-
const disposable = process.onProcessData(e => recorder.handleData(isString(e) ? e : e.data));
|
|
798
|
-
return [recorder, disposable];
|
|
799
|
-
}
|
|
800
|
-
_getDataFromRecorder(recorder) {
|
|
801
|
-
return ( recorder.generateReplayEventSync().events.filter(e => !!e.data).map(e => e.data)).join("");
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
SeamlessRelaunchDataFilter = ( __decorate([( __param(0, ITerminalLogService))], SeamlessRelaunchDataFilter));
|
|
805
|
-
|
|
806
|
-
export { TerminalProcessManager };
|