@codingame/monaco-vscode-xterm-common 25.1.1 → 26.0.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 +4 -4
- package/vscode/src/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +2 -2
- package/vscode/src/vs/platform/terminal/common/environmentVariableCollection.js +20 -16
- package/vscode/src/vs/platform/terminal/common/terminalRecorder.js +20 -11
- package/vscode/src/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +15 -21
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +386 -301
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +11 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +4 -8
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +0 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +793 -549
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +225 -128
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalResizeDebouncer.js +14 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalStatusList.js +23 -19
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +174 -126
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +29 -22
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +3 -1
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalEnvironment.js +112 -114
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +16 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollContribution.js +33 -23
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollOverlay.js +115 -84
|
@@ -40,7 +40,6 @@ import { INotificationService } from '@codingame/monaco-vscode-api/vscode/vs/pla
|
|
|
40
40
|
import { IOpenerService } from '@codingame/monaco-vscode-api/vscode/vs/platform/opener/common/opener.service';
|
|
41
41
|
import { IProductService } from '@codingame/monaco-vscode-api/vscode/vs/platform/product/common/productService.service';
|
|
42
42
|
import { IQuickInputService } from '@codingame/monaco-vscode-api/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
43
|
-
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
44
43
|
import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
|
|
45
44
|
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
46
45
|
import { TerminalCapability } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/capabilities';
|
|
@@ -81,7 +80,7 @@ import { getTerminalUri, getTerminalResourcesFromDragEvent } from '@codingame/mo
|
|
|
81
80
|
import { TerminalWidgetManager } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/widgets/widgetManager';
|
|
82
81
|
import { LineDataEventAddon } from './xterm/lineDataEventAddon.js';
|
|
83
82
|
import { getXtermScaledDimensions, XtermTerminal } from '@codingame/monaco-vscode-xterm-addons-common/vscode/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal';
|
|
84
|
-
import { ProcessState, TERMINAL_VIEW_ID,
|
|
83
|
+
import { ProcessState, TERMINAL_VIEW_ID, TerminalCommandId, DEFAULT_COMMANDS_TO_SKIP_SHELL } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal';
|
|
85
84
|
import { ITerminalProfileResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminal.service';
|
|
86
85
|
import { TERMINAL_BACKGROUND_COLOR } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry';
|
|
87
86
|
import { TerminalContextKeys } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/common/terminalContextKey';
|
|
@@ -107,7 +106,7 @@ import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severit
|
|
|
107
106
|
|
|
108
107
|
var TerminalInstance_1;
|
|
109
108
|
var Constants;
|
|
110
|
-
(function
|
|
109
|
+
(function(Constants) {
|
|
111
110
|
Constants[Constants["WaitForContainerThreshold"] = 100] = "WaitForContainerThreshold";
|
|
112
111
|
Constants[Constants["DefaultCols"] = 80] = "DefaultCols";
|
|
113
112
|
Constants[Constants["DefaultRows"] = 30] = "DefaultRows";
|
|
@@ -118,31 +117,55 @@ const shellIntegrationSupportedShellTypes = [
|
|
|
118
117
|
PosixShellType.Bash,
|
|
119
118
|
PosixShellType.Zsh,
|
|
120
119
|
GeneralShellType.PowerShell,
|
|
121
|
-
GeneralShellType.Python
|
|
120
|
+
GeneralShellType.Python
|
|
122
121
|
];
|
|
123
122
|
let TerminalInstance = class TerminalInstance extends Disposable {
|
|
124
|
-
static {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
static {
|
|
124
|
+
TerminalInstance_1 = this;
|
|
125
|
+
}
|
|
126
|
+
static {
|
|
127
|
+
this._instanceIdCounter = 1;
|
|
128
|
+
}
|
|
129
|
+
get xtermReadyPromise() {
|
|
130
|
+
return this._xtermReadyPromise;
|
|
131
|
+
}
|
|
132
|
+
get domElement() {
|
|
133
|
+
return this._wrapperElement;
|
|
134
|
+
}
|
|
135
|
+
get usedShellIntegrationInjection() {
|
|
136
|
+
return this._usedShellIntegrationInjection;
|
|
137
|
+
}
|
|
138
|
+
get shellIntegrationInjectionFailureReason() {
|
|
139
|
+
return this._shellIntegrationInjectionInfo;
|
|
140
|
+
}
|
|
130
141
|
get store() {
|
|
131
142
|
return this._store;
|
|
132
143
|
}
|
|
133
|
-
get extEnvironmentVariableCollection() {
|
|
134
|
-
|
|
144
|
+
get extEnvironmentVariableCollection() {
|
|
145
|
+
return this._processManager.extEnvironmentVariableCollection;
|
|
146
|
+
}
|
|
147
|
+
get waitOnExit() {
|
|
148
|
+
return this._shellLaunchConfig.attachPersistentProcess?.waitOnExit || this._shellLaunchConfig.waitOnExit;
|
|
149
|
+
}
|
|
135
150
|
set waitOnExit(value) {
|
|
136
151
|
this._shellLaunchConfig.waitOnExit = value;
|
|
137
152
|
}
|
|
138
|
-
get targetRef() {
|
|
139
|
-
|
|
153
|
+
get targetRef() {
|
|
154
|
+
return this._targetRef;
|
|
155
|
+
}
|
|
156
|
+
get target() {
|
|
157
|
+
return this._targetRef.object;
|
|
158
|
+
}
|
|
140
159
|
set target(value) {
|
|
141
160
|
this._targetRef.object = value;
|
|
142
161
|
this._onDidChangeTarget.fire(value);
|
|
143
162
|
}
|
|
144
|
-
get instanceId() {
|
|
145
|
-
|
|
163
|
+
get instanceId() {
|
|
164
|
+
return this._instanceId;
|
|
165
|
+
}
|
|
166
|
+
get resource() {
|
|
167
|
+
return this._resource;
|
|
168
|
+
}
|
|
146
169
|
get cols() {
|
|
147
170
|
if (this._fixedCols !== undefined) {
|
|
148
171
|
return this._fixedCols;
|
|
@@ -167,53 +190,157 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
167
190
|
}
|
|
168
191
|
return this._rows;
|
|
169
192
|
}
|
|
170
|
-
get isDisposed() {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
get
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
get
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
get
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
get
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
get
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
get
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
get
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
get
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
get
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
get
|
|
201
|
-
|
|
193
|
+
get isDisposed() {
|
|
194
|
+
return this._store.isDisposed;
|
|
195
|
+
}
|
|
196
|
+
get fixedCols() {
|
|
197
|
+
return this._fixedCols;
|
|
198
|
+
}
|
|
199
|
+
get fixedRows() {
|
|
200
|
+
return this._fixedRows;
|
|
201
|
+
}
|
|
202
|
+
get maxCols() {
|
|
203
|
+
return this._cols;
|
|
204
|
+
}
|
|
205
|
+
get maxRows() {
|
|
206
|
+
return this._rows;
|
|
207
|
+
}
|
|
208
|
+
get processId() {
|
|
209
|
+
return this._processManager.shellProcessId;
|
|
210
|
+
}
|
|
211
|
+
get processReady() {
|
|
212
|
+
return this._processManager.ptyProcessReady;
|
|
213
|
+
}
|
|
214
|
+
get hasChildProcesses() {
|
|
215
|
+
return this.shellLaunchConfig.attachPersistentProcess?.hasChildProcesses || this._processManager.hasChildProcesses;
|
|
216
|
+
}
|
|
217
|
+
get reconnectionProperties() {
|
|
218
|
+
return this.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties || this.shellLaunchConfig.reconnectionProperties;
|
|
219
|
+
}
|
|
220
|
+
get areLinksReady() {
|
|
221
|
+
return this._areLinksReady;
|
|
222
|
+
}
|
|
223
|
+
get initialDataEvents() {
|
|
224
|
+
return this._initialDataEvents;
|
|
225
|
+
}
|
|
226
|
+
get exitCode() {
|
|
227
|
+
return this._exitCode;
|
|
228
|
+
}
|
|
229
|
+
get exitReason() {
|
|
230
|
+
return this._exitReason;
|
|
231
|
+
}
|
|
232
|
+
get hadFocusOnExit() {
|
|
233
|
+
return this._hadFocusOnExit;
|
|
234
|
+
}
|
|
235
|
+
get isTitleSetByProcess() {
|
|
236
|
+
return !!this._messageTitleDisposable.value;
|
|
237
|
+
}
|
|
238
|
+
get shellLaunchConfig() {
|
|
239
|
+
return this._shellLaunchConfig;
|
|
240
|
+
}
|
|
241
|
+
get shellType() {
|
|
242
|
+
return this._shellType;
|
|
243
|
+
}
|
|
244
|
+
get os() {
|
|
245
|
+
return this._processManager.os;
|
|
246
|
+
}
|
|
247
|
+
get hasRemoteAuthority() {
|
|
248
|
+
return this._processManager.remoteAuthority !== undefined;
|
|
249
|
+
}
|
|
250
|
+
get remoteAuthority() {
|
|
251
|
+
return this._processManager.remoteAuthority;
|
|
252
|
+
}
|
|
253
|
+
get hasFocus() {
|
|
254
|
+
return isAncestorOfActiveElement(this._wrapperElement);
|
|
255
|
+
}
|
|
256
|
+
get title() {
|
|
257
|
+
return this._title;
|
|
258
|
+
}
|
|
259
|
+
get titleSource() {
|
|
260
|
+
return this._titleSource;
|
|
261
|
+
}
|
|
262
|
+
get icon() {
|
|
263
|
+
return this._getIcon();
|
|
264
|
+
}
|
|
265
|
+
get color() {
|
|
266
|
+
return this._getColor();
|
|
267
|
+
}
|
|
268
|
+
get processName() {
|
|
269
|
+
return this._processName;
|
|
270
|
+
}
|
|
271
|
+
get sequence() {
|
|
272
|
+
return this._sequence;
|
|
273
|
+
}
|
|
274
|
+
get staticTitle() {
|
|
275
|
+
return this._staticTitle;
|
|
276
|
+
}
|
|
277
|
+
get progressState() {
|
|
278
|
+
return this.xterm?.progressState;
|
|
279
|
+
}
|
|
280
|
+
get workspaceFolder() {
|
|
281
|
+
return this._workspaceFolder;
|
|
282
|
+
}
|
|
283
|
+
get cwd() {
|
|
284
|
+
return this._cwd;
|
|
285
|
+
}
|
|
286
|
+
get initialCwd() {
|
|
287
|
+
return this._initialCwd;
|
|
288
|
+
}
|
|
202
289
|
get description() {
|
|
203
290
|
if (this._description) {
|
|
204
291
|
return this._description;
|
|
205
292
|
}
|
|
206
293
|
const type = this.shellLaunchConfig.attachPersistentProcess?.type || this.shellLaunchConfig.type;
|
|
207
294
|
switch (type) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
295
|
+
case "Task":
|
|
296
|
+
return terminalStrings.typeTask;
|
|
297
|
+
case "Local":
|
|
298
|
+
return terminalStrings.typeLocal;
|
|
299
|
+
default:
|
|
300
|
+
return undefined;
|
|
211
301
|
}
|
|
212
302
|
}
|
|
213
|
-
get userHome() {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
303
|
+
get userHome() {
|
|
304
|
+
return this._userHome;
|
|
305
|
+
}
|
|
306
|
+
get shellIntegrationNonce() {
|
|
307
|
+
return this._processManager.shellIntegrationNonce;
|
|
308
|
+
}
|
|
309
|
+
get injectedArgs() {
|
|
310
|
+
return this._injectedArgs;
|
|
311
|
+
}
|
|
312
|
+
constructor(
|
|
313
|
+
_terminalShellTypeContextKey,
|
|
314
|
+
_shellLaunchConfig,
|
|
315
|
+
_contextKeyService,
|
|
316
|
+
_contextMenuService,
|
|
317
|
+
instantiationService,
|
|
318
|
+
_terminalConfigurationService,
|
|
319
|
+
_terminalProfileResolverService,
|
|
320
|
+
_pathService,
|
|
321
|
+
_fileService,
|
|
322
|
+
_keybindingService,
|
|
323
|
+
_notificationService,
|
|
324
|
+
_preferencesService,
|
|
325
|
+
_viewsService,
|
|
326
|
+
_themeService,
|
|
327
|
+
_configurationService,
|
|
328
|
+
_logService,
|
|
329
|
+
_storageService,
|
|
330
|
+
_accessibilityService,
|
|
331
|
+
_productService,
|
|
332
|
+
_quickInputService,
|
|
333
|
+
_workbenchEnvironmentService,
|
|
334
|
+
_workspaceContextService,
|
|
335
|
+
_editorService,
|
|
336
|
+
_workspaceTrustRequestService,
|
|
337
|
+
_historyService,
|
|
338
|
+
_telemetryService,
|
|
339
|
+
_openerService,
|
|
340
|
+
_commandService,
|
|
341
|
+
_accessibilitySignalService,
|
|
342
|
+
_viewDescriptorService
|
|
343
|
+
) {
|
|
217
344
|
super();
|
|
218
345
|
this._terminalShellTypeContextKey = _terminalShellTypeContextKey;
|
|
219
346
|
this._shellLaunchConfig = _shellLaunchConfig;
|
|
@@ -225,14 +352,11 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
225
352
|
this._fileService = _fileService;
|
|
226
353
|
this._keybindingService = _keybindingService;
|
|
227
354
|
this._notificationService = _notificationService;
|
|
228
|
-
this._preferencesService = _preferencesService;
|
|
229
355
|
this._viewsService = _viewsService;
|
|
230
356
|
this._themeService = _themeService;
|
|
231
357
|
this._configurationService = _configurationService;
|
|
232
358
|
this._logService = _logService;
|
|
233
|
-
this._storageService = _storageService;
|
|
234
359
|
this._accessibilityService = _accessibilityService;
|
|
235
|
-
this._productService = _productService;
|
|
236
360
|
this._quickInputService = _quickInputService;
|
|
237
361
|
this._workbenchEnvironmentService = _workbenchEnvironmentService;
|
|
238
362
|
this._workspaceContextService = _workspaceContextService;
|
|
@@ -247,7 +371,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
247
371
|
this._contributions = ( new Map());
|
|
248
372
|
this._latestXtermWriteData = 0;
|
|
249
373
|
this._latestXtermParseData = 0;
|
|
250
|
-
this._title =
|
|
374
|
+
this._title = "";
|
|
251
375
|
this._titleSource = TitleEventSource.Process;
|
|
252
376
|
this._cols = 0;
|
|
253
377
|
this._rows = 0;
|
|
@@ -260,7 +384,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
260
384
|
this._initialDataEvents = [];
|
|
261
385
|
this._messageTitleDisposable = this._register(( new MutableDisposable()));
|
|
262
386
|
this._dndObserver = this._register(( new MutableDisposable()));
|
|
263
|
-
this._processName =
|
|
387
|
+
this._processName = "";
|
|
264
388
|
this._usedShellIntegrationInjection = false;
|
|
265
389
|
this.capabilities = this._register(( new TerminalCapabilityStoreMultiplexer()));
|
|
266
390
|
this.disableLayout = false;
|
|
@@ -318,19 +442,22 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
318
442
|
})));
|
|
319
443
|
this.onLineData = this._onLineData.event;
|
|
320
444
|
this.sessionId = generateUuid();
|
|
321
|
-
this._wrapperElement = createElement(
|
|
322
|
-
this._wrapperElement.classList.add(
|
|
445
|
+
this._wrapperElement = createElement("div");
|
|
446
|
+
this._wrapperElement.classList.add("terminal-wrapper");
|
|
323
447
|
this._widgetManager = this._register(instantiationService.createInstance(TerminalWidgetManager));
|
|
324
448
|
this._skipTerminalCommands = [];
|
|
325
449
|
this._isExiting = false;
|
|
326
450
|
this._hadFocusOnExit = false;
|
|
327
451
|
this._isVisible = false;
|
|
328
452
|
this._instanceId = TerminalInstance_1._instanceIdCounter++;
|
|
329
|
-
this._hasHadInput = false;
|
|
330
453
|
this._fixedRows = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.rows;
|
|
331
454
|
this._fixedCols = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.cols;
|
|
332
455
|
this._shellLaunchConfig.shellIntegrationEnvironmentReporting = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnvironmentReporting);
|
|
333
|
-
this._resource = getTerminalUri(
|
|
456
|
+
this._resource = getTerminalUri(
|
|
457
|
+
this._workspaceContextService.getWorkspace().id,
|
|
458
|
+
this.instanceId,
|
|
459
|
+
this.title
|
|
460
|
+
);
|
|
334
461
|
if (this._shellLaunchConfig.attachPersistentProcess?.hideFromUser) {
|
|
335
462
|
this._shellLaunchConfig.hideFromUser = this._shellLaunchConfig.attachPersistentProcess.hideFromUser;
|
|
336
463
|
}
|
|
@@ -364,9 +491,16 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
364
491
|
this._terminalHasTextContextKey = TerminalContextKeys.textSelected.bindTo(this._contextKeyService);
|
|
365
492
|
this._terminalAltBufferActiveContextKey = TerminalContextKeys.altBufferActive.bindTo(scopedContextKeyService);
|
|
366
493
|
this._terminalShellIntegrationEnabledContextKey = TerminalContextKeys.terminalShellIntegrationEnabled.bindTo(scopedContextKeyService);
|
|
367
|
-
this._logService.trace(
|
|
368
|
-
|
|
369
|
-
|
|
494
|
+
this._logService.trace(
|
|
495
|
+
`terminalInstance#ctor (instanceId: ${this.instanceId})`,
|
|
496
|
+
this._shellLaunchConfig
|
|
497
|
+
);
|
|
498
|
+
this._register(
|
|
499
|
+
this.capabilities.onDidAddCapability(e => this._logService.debug("terminalInstance added capability", e.id))
|
|
500
|
+
);
|
|
501
|
+
this._register(
|
|
502
|
+
this.capabilities.onDidRemoveCapability(e => this._logService.debug("terminalInstance removed capability", e.id))
|
|
503
|
+
);
|
|
370
504
|
const capabilityListeners = this._register(( new DisposableMap()));
|
|
371
505
|
this._register(this.capabilities.onDidAddCapability(e => {
|
|
372
506
|
capabilityListeners.get(e.id)?.dispose();
|
|
@@ -375,17 +509,23 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
375
509
|
this._refreshShellIntegrationInfoStatus(this);
|
|
376
510
|
};
|
|
377
511
|
switch (e.id) {
|
|
378
|
-
|
|
512
|
+
case TerminalCapability.CwdDetection:
|
|
513
|
+
{
|
|
379
514
|
capabilityListeners.set(e.id, e.capability.onDidChangeCwd(e => {
|
|
380
515
|
this._cwd = e;
|
|
381
516
|
this._setTitle(this.title, TitleEventSource.Config);
|
|
382
517
|
}));
|
|
383
518
|
break;
|
|
384
519
|
}
|
|
385
|
-
|
|
520
|
+
case TerminalCapability.CommandDetection:
|
|
521
|
+
{
|
|
386
522
|
e.capability.promptInputModel.setShellType(this.shellType);
|
|
387
|
-
capabilityListeners.set(e.id, Event.any(
|
|
388
|
-
|
|
523
|
+
capabilityListeners.set(e.id, Event.any(
|
|
524
|
+
e.capability.promptInputModel.onDidStartInput,
|
|
525
|
+
e.capability.promptInputModel.onDidChangeInput,
|
|
526
|
+
e.capability.promptInputModel.onDidFinishInput
|
|
527
|
+
)(refreshInfo));
|
|
528
|
+
this._register(e.capability.onCommandExecuted(async command => {
|
|
389
529
|
if (!command.id && command.command) {
|
|
390
530
|
const commandId = generateUuid();
|
|
391
531
|
this.xterm?.shellIntegration.setNextCommandId(command.command, commandId);
|
|
@@ -394,13 +534,16 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
394
534
|
}));
|
|
395
535
|
break;
|
|
396
536
|
}
|
|
397
|
-
|
|
537
|
+
case TerminalCapability.PromptTypeDetection:
|
|
538
|
+
{
|
|
398
539
|
capabilityListeners.set(e.id, e.capability.onPromptTypeChanged(refreshInfo));
|
|
399
540
|
break;
|
|
400
541
|
}
|
|
401
542
|
}
|
|
402
543
|
}));
|
|
403
|
-
this._register(
|
|
544
|
+
this._register(
|
|
545
|
+
this.onDidChangeShellType(() => this._refreshShellIntegrationInfoStatus(this))
|
|
546
|
+
);
|
|
404
547
|
this._register(this.capabilities.onDidRemoveCapability(e => {
|
|
405
548
|
capabilityListeners.get(e.id)?.dispose();
|
|
406
549
|
}));
|
|
@@ -422,7 +565,10 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
422
565
|
let os;
|
|
423
566
|
if (!this.shellLaunchConfig.customPtyImplementation && this._terminalConfigurationService.config.shellIntegration?.enabled && !this.shellLaunchConfig.executable) {
|
|
424
567
|
os = await this._processManager.getBackendOS();
|
|
425
|
-
const defaultProfile = (await this._terminalProfileResolverService.getDefaultProfile({
|
|
568
|
+
const defaultProfile = (await this._terminalProfileResolverService.getDefaultProfile({
|
|
569
|
+
remoteAuthority: this.remoteAuthority,
|
|
570
|
+
os
|
|
571
|
+
}));
|
|
426
572
|
this.shellLaunchConfig.executable = defaultProfile.path;
|
|
427
573
|
this.shellLaunchConfig.args = defaultProfile.args;
|
|
428
574
|
this.shellLaunchConfig.icon ??= defaultProfile.icon;
|
|
@@ -435,22 +581,25 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
435
581
|
await this._createProcess();
|
|
436
582
|
if (this.shellLaunchConfig.attachPersistentProcess) {
|
|
437
583
|
this._cwd = this.shellLaunchConfig.attachPersistentProcess.cwd;
|
|
438
|
-
this._setTitle(
|
|
584
|
+
this._setTitle(
|
|
585
|
+
this.shellLaunchConfig.attachPersistentProcess.title,
|
|
586
|
+
this.shellLaunchConfig.attachPersistentProcess.titleSource
|
|
587
|
+
);
|
|
439
588
|
this.setShellType(this.shellType);
|
|
440
589
|
}
|
|
441
590
|
if (this._fixedCols) {
|
|
442
591
|
await this._addScrollbar();
|
|
443
592
|
}
|
|
444
|
-
}).catch(
|
|
593
|
+
}).catch(err => {
|
|
445
594
|
if (!this.isDisposed) {
|
|
446
595
|
throw err;
|
|
447
596
|
}
|
|
448
597
|
});
|
|
449
|
-
this._register(this._configurationService.onDidChangeConfiguration(async
|
|
598
|
+
this._register(this._configurationService.onDidChangeConfiguration(async e => {
|
|
450
599
|
if (e.affectsConfiguration(AccessibilityVerbositySettingId.Terminal)) {
|
|
451
600
|
this._setAriaLabel(this.xterm?.raw, this._instanceId, this.title);
|
|
452
601
|
}
|
|
453
|
-
if (e.affectsConfiguration(
|
|
602
|
+
if (e.affectsConfiguration("terminal.integrated")) {
|
|
454
603
|
this.updateConfig();
|
|
455
604
|
this.setVisible(this._isVisible);
|
|
456
605
|
}
|
|
@@ -461,7 +610,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
461
610
|
TerminalSettingId.FontWeightBold,
|
|
462
611
|
TerminalSettingId.LetterSpacing,
|
|
463
612
|
TerminalSettingId.LineHeight,
|
|
464
|
-
|
|
613
|
+
"editor.fontFamily"
|
|
465
614
|
];
|
|
466
615
|
if (( layoutSettings.some(id => e.affectsConfiguration(id)))) {
|
|
467
616
|
this._layoutSettingsChanged = true;
|
|
@@ -470,16 +619,16 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
470
619
|
if (e.affectsConfiguration(TerminalSettingId.UnicodeVersion)) {
|
|
471
620
|
this._updateUnicodeVersion();
|
|
472
621
|
}
|
|
473
|
-
if (e.affectsConfiguration(
|
|
622
|
+
if (e.affectsConfiguration("editor.accessibilitySupport")) {
|
|
474
623
|
this.updateAccessibilitySupport();
|
|
475
624
|
}
|
|
476
|
-
if (e.affectsConfiguration(TerminalSettingId.TerminalTitle) ||
|
|
477
|
-
e.affectsConfiguration(TerminalSettingId.TerminalTitleSeparator) ||
|
|
478
|
-
e.affectsConfiguration(TerminalSettingId.TerminalDescription)) {
|
|
625
|
+
if (e.affectsConfiguration(TerminalSettingId.TerminalTitle) || e.affectsConfiguration(TerminalSettingId.TerminalTitleSeparator) || e.affectsConfiguration(TerminalSettingId.TerminalDescription)) {
|
|
479
626
|
this._labelComputer?.refreshLabel(this);
|
|
480
627
|
}
|
|
481
628
|
}));
|
|
482
|
-
this._register(
|
|
629
|
+
this._register(
|
|
630
|
+
this._workspaceContextService.onDidChangeWorkspaceFolders(() => this._labelComputer?.refreshLabel(this))
|
|
631
|
+
);
|
|
483
632
|
let initialDataEventsTimeout = getWindow(this._container).setTimeout(() => {
|
|
484
633
|
initialDataEventsTimeout = undefined;
|
|
485
634
|
this._initialDataEvents = undefined;
|
|
@@ -504,8 +653,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
504
653
|
widgetManager: this._widgetManager
|
|
505
654
|
}));
|
|
506
655
|
this._contributions.set(desc.id, contribution);
|
|
507
|
-
}
|
|
508
|
-
catch (err) {
|
|
656
|
+
} catch (err) {
|
|
509
657
|
onUnexpectedError(err);
|
|
510
658
|
}
|
|
511
659
|
this._xtermReadyPromise.then(xterm => {
|
|
@@ -528,9 +676,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
528
676
|
}
|
|
529
677
|
_getIcon() {
|
|
530
678
|
if (!this._icon) {
|
|
531
|
-
this._icon = this._processManager.processState >= ProcessState.Launching
|
|
532
|
-
? getIconRegistry().getIcon(this._configurationService.getValue(TerminalSettingId.TabsDefaultIcon))
|
|
533
|
-
: undefined;
|
|
679
|
+
this._icon = this._processManager.processState >= ProcessState.Launching ? getIconRegistry().getIcon(this._configurationService.getValue(TerminalSettingId.TabsDefaultIcon)) : undefined;
|
|
534
680
|
}
|
|
535
681
|
return this._icon;
|
|
536
682
|
}
|
|
@@ -600,26 +746,33 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
600
746
|
const computedStyle = getWindow(this.xterm.raw.element).getComputedStyle(this.xterm.raw.element);
|
|
601
747
|
const horizontalPadding = parseInt(computedStyle.paddingLeft) + parseInt(computedStyle.paddingRight) + 14 ;
|
|
602
748
|
const verticalPadding = parseInt(computedStyle.paddingTop) + parseInt(computedStyle.paddingBottom);
|
|
603
|
-
TerminalInstance_1._lastKnownCanvasDimensions = new Dimension(
|
|
749
|
+
TerminalInstance_1._lastKnownCanvasDimensions = new Dimension(
|
|
750
|
+
Math.min(Constants.MaxCanvasWidth, width - horizontalPadding),
|
|
751
|
+
height - verticalPadding + (this._hasScrollBar && this._horizontalScrollbar ? -5 : 0)
|
|
752
|
+
);
|
|
604
753
|
return TerminalInstance_1._lastKnownCanvasDimensions;
|
|
605
754
|
}
|
|
606
|
-
get persistentProcessId() {
|
|
607
|
-
|
|
755
|
+
get persistentProcessId() {
|
|
756
|
+
return this._processManager.persistentProcessId;
|
|
757
|
+
}
|
|
758
|
+
get shouldPersist() {
|
|
759
|
+
return this._processManager.shouldPersist && !this.shellLaunchConfig.isTransient && (!this.reconnectionProperties || this._configurationService.getValue("task.reconnection") === true);
|
|
760
|
+
}
|
|
608
761
|
static getXtermConstructor(keybindingService, contextKeyService) {
|
|
609
762
|
const keybinding = keybindingService.lookupKeybinding(TerminalContribCommandId.A11yFocusAccessibleBuffer, contextKeyService);
|
|
610
763
|
if (xtermConstructor) {
|
|
611
764
|
return xtermConstructor;
|
|
612
765
|
}
|
|
613
|
-
xtermConstructor = Promises.withAsyncBody(async
|
|
614
|
-
const Terminal = (await import('@xterm/xterm')
|
|
615
|
-
Terminal.strings.promptLabel = ( localize(
|
|
766
|
+
xtermConstructor = Promises.withAsyncBody(async resolve => {
|
|
767
|
+
const Terminal = (await import('@xterm/xterm')).Terminal;
|
|
768
|
+
Terminal.strings.promptLabel = ( localize(11903, "Terminal input"));
|
|
616
769
|
Terminal.strings.tooMuchOutput = keybinding ? ( localize(
|
|
617
|
-
|
|
618
|
-
|
|
770
|
+
11904,
|
|
771
|
+
"Use the accessible buffer {0} to manually review output",
|
|
619
772
|
keybinding.getLabel()
|
|
620
773
|
)) : ( localize(
|
|
621
|
-
|
|
622
|
-
|
|
774
|
+
11905,
|
|
775
|
+
"Use the Terminal: Focus Accessible Buffer command to manually review output"
|
|
623
776
|
));
|
|
624
777
|
resolve(Terminal);
|
|
625
778
|
});
|
|
@@ -637,16 +790,16 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
637
790
|
xtermColorProvider: this._scopedInstantiationService.createInstance(TerminalInstanceColorProvider, this._targetRef),
|
|
638
791
|
capabilities: this.capabilities,
|
|
639
792
|
shellIntegrationNonce: this._processManager.shellIntegrationNonce,
|
|
640
|
-
disableShellIntegrationReporting
|
|
793
|
+
disableShellIntegrationReporting
|
|
641
794
|
}, this.onDidExecuteText);
|
|
642
795
|
this.xterm = xterm;
|
|
643
796
|
this._resizeDebouncer = this._register(( new TerminalResizeDebouncer(() => this._isVisible, () => xterm, async (cols, rows) => {
|
|
644
797
|
xterm.resize(cols, rows);
|
|
645
798
|
await this._updatePtyDimensions(xterm.raw);
|
|
646
|
-
}, async
|
|
799
|
+
}, async cols => {
|
|
647
800
|
xterm.resize(cols, xterm.raw.rows);
|
|
648
801
|
await this._updatePtyDimensions(xterm.raw);
|
|
649
|
-
}, async
|
|
802
|
+
}, async rows => {
|
|
650
803
|
xterm.resize(xterm.raw.cols, rows);
|
|
651
804
|
await this._updatePtyDimensions(xterm.raw);
|
|
652
805
|
})));
|
|
@@ -671,7 +824,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
671
824
|
id: TerminalStatus.Bell,
|
|
672
825
|
severity: Severity.Warning,
|
|
673
826
|
icon: Codicon.bell,
|
|
674
|
-
tooltip: ( localize(
|
|
827
|
+
tooltip: ( localize(11906, "Bell"))
|
|
675
828
|
}, this._terminalConfigurationService.config.bellDuration);
|
|
676
829
|
}
|
|
677
830
|
this._accessibilitySignalService.playSignal(AccessibilitySignal.terminalBell);
|
|
@@ -680,15 +833,17 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
680
833
|
this._register(xterm.raw.onSelectionChange(() => this._onDidChangeSelection.fire(this)));
|
|
681
834
|
this._register(xterm.raw.buffer.onBufferChange(() => this._refreshAltBufferContextKey()));
|
|
682
835
|
this._register(this._processManager.onProcessData(e => this._onProcessData(e)));
|
|
683
|
-
this._register(xterm.raw.onData(async
|
|
836
|
+
this._register(xterm.raw.onData(async data => {
|
|
684
837
|
await this._handleOnData(data);
|
|
685
838
|
}));
|
|
686
839
|
this._register(xterm.raw.onBinary(data => this._processManager.processBinary(data)));
|
|
687
|
-
this._register(this._processManager.onProcessReady(async
|
|
688
|
-
if (processTraits?.windowsPty?.backend ===
|
|
689
|
-
this._register(xterm.raw.parser.registerCsiHandler({
|
|
840
|
+
this._register(this._processManager.onProcessReady(async processTraits => {
|
|
841
|
+
if (processTraits?.windowsPty?.backend === "conpty") {
|
|
842
|
+
this._register(xterm.raw.parser.registerCsiHandler({
|
|
843
|
+
final: "c"
|
|
844
|
+
}, params => {
|
|
690
845
|
if (params.length === 0 || params.length === 1 && params[0] === 0) {
|
|
691
|
-
this._handleOnData(
|
|
846
|
+
this._handleOnData("\u001b[?61;4c");
|
|
692
847
|
return true;
|
|
693
848
|
}
|
|
694
849
|
return false;
|
|
@@ -699,18 +854,26 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
699
854
|
}
|
|
700
855
|
xterm.raw.options.windowsPty = processTraits.windowsPty;
|
|
701
856
|
}));
|
|
702
|
-
this._register(
|
|
703
|
-
|
|
857
|
+
this._register(
|
|
858
|
+
this._processManager.onRestoreCommands(e => this.xterm?.shellIntegration.deserialize(e))
|
|
859
|
+
);
|
|
860
|
+
this._register(this._viewDescriptorService.onDidChangeLocation((
|
|
861
|
+
{
|
|
862
|
+
views
|
|
863
|
+
}
|
|
864
|
+
) => {
|
|
704
865
|
if (( views.some(v => v.id === TERMINAL_VIEW_ID))) {
|
|
705
866
|
xterm.refresh();
|
|
706
867
|
}
|
|
707
868
|
}));
|
|
708
869
|
this._register(xterm.onDidChangeProgress(() => this._labelComputer?.refreshLabel(this)));
|
|
709
|
-
this._register(
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
870
|
+
this._register(
|
|
871
|
+
Event.runAndSubscribe(xterm.shellIntegration.onDidChangeSeenSequences, () => {
|
|
872
|
+
if (xterm.shellIntegration.seenSequences.size > 0) {
|
|
873
|
+
this._refreshShellIntegrationInfoStatus(this);
|
|
874
|
+
}
|
|
875
|
+
})
|
|
876
|
+
);
|
|
714
877
|
if (!( this.capabilities.has(TerminalCapability.CwdDetection))) {
|
|
715
878
|
let onKeyListener = xterm.raw.onKey(e => {
|
|
716
879
|
const event = ( new StandardKeyboardEvent(e.domEvent));
|
|
@@ -738,13 +901,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
738
901
|
if (!instance.xterm) {
|
|
739
902
|
return;
|
|
740
903
|
}
|
|
741
|
-
const cmdDetectionType = (instance.capabilities.get(TerminalCapability.CommandDetection)?.hasRichCommandDetection
|
|
742
|
-
? ( localize(11581, 'Rich'))
|
|
743
|
-
: ( instance.capabilities.has(TerminalCapability.CommandDetection))
|
|
744
|
-
? ( localize(11582, 'Basic'))
|
|
745
|
-
: instance.usedShellIntegrationInjection
|
|
746
|
-
? ( localize(11583, "Injection failed to activate"))
|
|
747
|
-
: ( localize(11584, 'No')));
|
|
904
|
+
const cmdDetectionType = (instance.capabilities.get(TerminalCapability.CommandDetection)?.hasRichCommandDetection ? ( localize(11907, "Rich")) : ( instance.capabilities.has(TerminalCapability.CommandDetection)) ? ( localize(11908, "Basic")) : instance.usedShellIntegrationInjection ? ( localize(11909, "Injection failed to activate")) : ( localize(11910, "No")));
|
|
748
905
|
const detailedAdditions = [];
|
|
749
906
|
if (instance.shellType) {
|
|
750
907
|
detailedAdditions.push(`Shell type: \`${instance.shellType}\``);
|
|
@@ -755,7 +912,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
755
912
|
}
|
|
756
913
|
const seenSequences = Array.from(instance.xterm.shellIntegration.seenSequences);
|
|
757
914
|
if (seenSequences.length > 0) {
|
|
758
|
-
detailedAdditions.push(`Seen sequences: ${( seenSequences.map(e => `\`${e}\``)).join(
|
|
915
|
+
detailedAdditions.push(`Seen sequences: ${( seenSequences.map(e => `\`${e}\``)).join(", ")}`);
|
|
759
916
|
}
|
|
760
917
|
const promptType = instance.capabilities.get(TerminalCapability.PromptTypeDetection)?.promptType;
|
|
761
918
|
if (promptType) {
|
|
@@ -765,38 +922,37 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
765
922
|
if (combinedString !== undefined) {
|
|
766
923
|
detailedAdditions.push(`Prompt input: \`\`\`${combinedString}\`\`\``);
|
|
767
924
|
}
|
|
768
|
-
const detailedAdditionsString = detailedAdditions.length > 0
|
|
769
|
-
? '\n\n' + ( detailedAdditions.map(e => `- ${e}`)).join('\n')
|
|
770
|
-
: '';
|
|
925
|
+
const detailedAdditionsString = detailedAdditions.length > 0 ? "\n\n" + ( detailedAdditions.map(e => `- ${e}`)).join("\n") : "";
|
|
771
926
|
instance.statusList.add({
|
|
772
927
|
id: TerminalStatus.ShellIntegrationInfo,
|
|
773
928
|
severity: Severity.Info,
|
|
774
|
-
tooltip: `${( localize(
|
|
775
|
-
detailedTooltip: `${( localize(
|
|
929
|
+
tooltip: `${( localize(11911, "Shell integration"))}: ${cmdDetectionType}`,
|
|
930
|
+
detailedTooltip: `${( localize(11911, "Shell integration"))}: ${cmdDetectionType}${detailedAdditionsString}`
|
|
776
931
|
});
|
|
777
932
|
}
|
|
778
933
|
async runCommand(commandLine, shouldExecute, commandId) {
|
|
779
934
|
let commandDetection = this.capabilities.get(TerminalCapability.CommandDetection);
|
|
780
935
|
const siInjectionEnabled = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) === true;
|
|
781
|
-
const timeoutMs = getShellIntegrationTimeout(
|
|
936
|
+
const timeoutMs = getShellIntegrationTimeout(
|
|
937
|
+
this._configurationService,
|
|
938
|
+
siInjectionEnabled,
|
|
939
|
+
this.hasRemoteAuthority,
|
|
940
|
+
this._processManager.processReadyTimestamp
|
|
941
|
+
);
|
|
782
942
|
if (!commandDetection || commandDetection.promptInputModel.state !== PromptInputState.Input) {
|
|
783
943
|
const store = ( new DisposableStore());
|
|
784
|
-
await Promise.race([
|
|
785
|
-
(
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
944
|
+
await Promise.race([( new Promise(r => {
|
|
945
|
+
store.add(this.capabilities.onDidAddCommandDetectionCapability(e => {
|
|
946
|
+
commandDetection = e;
|
|
947
|
+
if (commandDetection.promptInputModel.state === PromptInputState.Input) {
|
|
948
|
+
r();
|
|
949
|
+
} else {
|
|
950
|
+
store.add(commandDetection.promptInputModel.onDidStartInput(() => {
|
|
789
951
|
r();
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
}));
|
|
795
|
-
}
|
|
796
|
-
}));
|
|
797
|
-
})),
|
|
798
|
-
timeout(timeoutMs)
|
|
799
|
-
]);
|
|
952
|
+
}));
|
|
953
|
+
}
|
|
954
|
+
}));
|
|
955
|
+
})), timeout(timeoutMs)]);
|
|
800
956
|
store.dispose();
|
|
801
957
|
}
|
|
802
958
|
if (commandId && commandDetection) {
|
|
@@ -804,7 +960,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
804
960
|
await this._processManager.setNextCommandId(commandLine, commandId);
|
|
805
961
|
}
|
|
806
962
|
if (shouldExecute && (!commandDetection || commandDetection.promptInputModel.value.length > 0)) {
|
|
807
|
-
await this.sendText(
|
|
963
|
+
await this.sendText("\u0003", false);
|
|
808
964
|
await timeout(100);
|
|
809
965
|
}
|
|
810
966
|
await this.sendText(commandLine, shouldExecute, !shouldExecute);
|
|
@@ -839,11 +995,11 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
839
995
|
}
|
|
840
996
|
if (!this._container || !this._container.isConnected) {
|
|
841
997
|
throw ( new Error(
|
|
842
|
-
|
|
998
|
+
"A container element needs to be set with `attachToElement` and be part of the DOM before calling `_open`"
|
|
843
999
|
));
|
|
844
1000
|
}
|
|
845
|
-
const xtermHost = createElement(
|
|
846
|
-
xtermHost.classList.add(
|
|
1001
|
+
const xtermHost = createElement("div");
|
|
1002
|
+
xtermHost.classList.add("terminal-xterm-host");
|
|
847
1003
|
this._wrapperElement.appendChild(xtermHost);
|
|
848
1004
|
this._container.appendChild(this._wrapperElement);
|
|
849
1005
|
const xterm = this.xterm;
|
|
@@ -856,97 +1012,75 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
856
1012
|
contribution.xtermOpen?.(xterm);
|
|
857
1013
|
}
|
|
858
1014
|
});
|
|
859
|
-
}
|
|
860
|
-
else {
|
|
1015
|
+
} else {
|
|
861
1016
|
contribution.xtermOpen?.(this.xterm);
|
|
862
1017
|
}
|
|
863
1018
|
}
|
|
864
1019
|
this._register(xterm.shellIntegration.onDidChangeStatus(() => {
|
|
865
1020
|
if (this.hasFocus) {
|
|
866
1021
|
this._setShellIntegrationContextKey();
|
|
867
|
-
}
|
|
868
|
-
else {
|
|
1022
|
+
} else {
|
|
869
1023
|
this._terminalShellIntegrationEnabledContextKey.reset();
|
|
870
1024
|
}
|
|
871
1025
|
}));
|
|
872
1026
|
if (!xterm.raw.element || !xterm.raw.textarea) {
|
|
873
|
-
throw ( new Error(
|
|
1027
|
+
throw ( new Error("xterm elements not set after open"));
|
|
874
1028
|
}
|
|
875
1029
|
this._setAriaLabel(xterm.raw, this._instanceId, this._title);
|
|
876
|
-
xterm.raw.attachCustomKeyEventHandler(
|
|
1030
|
+
xterm.raw.attachCustomKeyEventHandler(event => {
|
|
877
1031
|
if (this._isExiting) {
|
|
878
1032
|
return false;
|
|
879
1033
|
}
|
|
880
1034
|
const standardKeyboardEvent = ( new StandardKeyboardEvent(event));
|
|
881
1035
|
const resolveResult = this._keybindingService.softDispatch(standardKeyboardEvent, standardKeyboardEvent.target);
|
|
882
|
-
const isValidChord = resolveResult.kind === ResultKind.MoreChordsNeeded && this._terminalConfigurationService.config.allowChords && event.key !==
|
|
1036
|
+
const isValidChord = resolveResult.kind === ResultKind.MoreChordsNeeded && this._terminalConfigurationService.config.allowChords && event.key !== "Escape";
|
|
883
1037
|
if (this._keybindingService.inChordMode || isValidChord) {
|
|
884
1038
|
event.preventDefault();
|
|
885
1039
|
return false;
|
|
886
1040
|
}
|
|
887
|
-
|
|
888
|
-
const EXCLUDED_KEYS = ['RightArrow', 'LeftArrow', 'UpArrow', 'DownArrow', 'Space', 'Meta', 'Control', 'Shift', 'Alt', '', 'Delete', 'Backspace', 'Tab'];
|
|
889
|
-
if (this._storageService.getBoolean(SHOW_TERMINAL_CONFIG_PROMPT_KEY, StorageScope.APPLICATION, true) &&
|
|
890
|
-
!EXCLUDED_KEYS.includes(event.key) &&
|
|
891
|
-
!event.ctrlKey &&
|
|
892
|
-
!event.shiftKey &&
|
|
893
|
-
!event.altKey) {
|
|
894
|
-
this._hasHadInput = true;
|
|
895
|
-
}
|
|
896
|
-
if (resolveResult.kind === ResultKind.KbFound && resolveResult.commandId && ( this._skipTerminalCommands.some(k => k === resolveResult.commandId)) && !this._terminalConfigurationService.config.sendKeybindingsToShell) {
|
|
897
|
-
if (this._storageService.getBoolean(SHOW_TERMINAL_CONFIG_PROMPT_KEY, StorageScope.APPLICATION, true) &&
|
|
898
|
-
this._hasHadInput &&
|
|
899
|
-
!TERMINAL_CREATION_COMMANDS.includes(resolveResult.commandId)) {
|
|
900
|
-
this._notificationService.prompt(Severity.Info, ( localize(
|
|
901
|
-
11586,
|
|
902
|
-
"Some keybindings don't go to the terminal by default and are handled by {0} instead.",
|
|
903
|
-
this._productService.nameLong
|
|
904
|
-
)), [
|
|
905
|
-
{
|
|
906
|
-
label: ( localize(11587, "Configure Terminal Settings")),
|
|
907
|
-
run: () => {
|
|
908
|
-
this._preferencesService.openSettings({ jsonEditor: false, query: `@id:${TerminalSettingId.CommandsToSkipShell},${TerminalSettingId.SendKeybindingsToShell},${TerminalSettingId.AllowChords}` });
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
]);
|
|
912
|
-
this._storageService.store(SHOW_TERMINAL_CONFIG_PROMPT_KEY, false, StorageScope.APPLICATION, StorageTarget.USER);
|
|
913
|
-
}
|
|
1041
|
+
if (!this._terminalConfigurationService.config.sendKeybindingsToShell && resolveResult.kind === ResultKind.KbFound && resolveResult.commandId && ( this._skipTerminalCommands.some(k => k === resolveResult.commandId))) {
|
|
914
1042
|
event.preventDefault();
|
|
915
1043
|
return false;
|
|
916
1044
|
}
|
|
917
1045
|
if (this._terminalConfigurationService.config.allowMnemonics && !isMacintosh && event.altKey) {
|
|
918
1046
|
return false;
|
|
919
1047
|
}
|
|
920
|
-
if (TabFocus.getTabFocusMode() && event.key ===
|
|
1048
|
+
if (TabFocus.getTabFocusMode() && event.key === "Tab") {
|
|
921
1049
|
return false;
|
|
922
1050
|
}
|
|
923
|
-
if (event.key ===
|
|
1051
|
+
if (event.key === "Tab" && event.shiftKey) {
|
|
924
1052
|
event.preventDefault();
|
|
925
1053
|
return true;
|
|
926
1054
|
}
|
|
927
|
-
if (isWindows && event.altKey && event.key ===
|
|
1055
|
+
if (isWindows && event.altKey && event.key === "F4" && !event.ctrlKey) {
|
|
928
1056
|
return false;
|
|
929
1057
|
}
|
|
930
|
-
if (!BrowserFeatures.clipboard.readText && event.key ===
|
|
1058
|
+
if (!BrowserFeatures.clipboard.readText && event.key === "v" && event.ctrlKey) {
|
|
931
1059
|
return false;
|
|
932
1060
|
}
|
|
933
1061
|
return true;
|
|
934
1062
|
});
|
|
935
|
-
this._register(addDisposableListener(xterm.raw.element,
|
|
936
|
-
const listener = addDisposableListener(xterm.raw.element.ownerDocument,
|
|
1063
|
+
this._register(addDisposableListener(xterm.raw.element, "mousedown", () => {
|
|
1064
|
+
const listener = addDisposableListener(xterm.raw.element.ownerDocument, "mouseup", () => {
|
|
937
1065
|
setTimeout(() => this._refreshSelectionContextKey(), 0);
|
|
938
1066
|
listener.dispose();
|
|
939
1067
|
});
|
|
940
1068
|
}));
|
|
941
|
-
this._register(addDisposableListener(xterm.raw.element,
|
|
1069
|
+
this._register(addDisposableListener(xterm.raw.element, "touchstart", () => {
|
|
942
1070
|
xterm.raw.focus();
|
|
943
1071
|
}));
|
|
944
|
-
this._register(addDisposableListener(xterm.raw.element,
|
|
1072
|
+
this._register(addDisposableListener(xterm.raw.element, "keyup", () => {
|
|
945
1073
|
setTimeout(() => this._refreshSelectionContextKey(), 0);
|
|
946
1074
|
}));
|
|
947
|
-
this._register(
|
|
948
|
-
|
|
949
|
-
|
|
1075
|
+
this._register(
|
|
1076
|
+
addDisposableListener(xterm.raw.textarea, "focus", () => this._setFocus(true))
|
|
1077
|
+
);
|
|
1078
|
+
this._register(
|
|
1079
|
+
addDisposableListener(xterm.raw.textarea, "blur", () => this._setFocus(false))
|
|
1080
|
+
);
|
|
1081
|
+
this._register(
|
|
1082
|
+
addDisposableListener(xterm.raw.textarea, "focusout", () => this._setFocus(false))
|
|
1083
|
+
);
|
|
950
1084
|
this._initDragAndDrop(this._container);
|
|
951
1085
|
this._widgetManager.attachToElement(screenElement);
|
|
952
1086
|
if (this._lastLayoutDimensions) {
|
|
@@ -962,8 +1096,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
962
1096
|
this._terminalFocusContextKey.set(true);
|
|
963
1097
|
this._setShellIntegrationContextKey();
|
|
964
1098
|
this._onDidFocus.fire(this);
|
|
965
|
-
}
|
|
966
|
-
else {
|
|
1099
|
+
} else {
|
|
967
1100
|
this.resetFocusContextKey();
|
|
968
1101
|
this._onDidBlur.fire(this);
|
|
969
1102
|
this._refreshSelectionContextKey();
|
|
@@ -980,9 +1113,13 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
980
1113
|
}
|
|
981
1114
|
_initDragAndDrop(container) {
|
|
982
1115
|
const store = ( new DisposableStore());
|
|
983
|
-
const dndController = store.add(
|
|
984
|
-
|
|
985
|
-
|
|
1116
|
+
const dndController = store.add(
|
|
1117
|
+
this._scopedInstantiationService.createInstance(TerminalInstanceDragAndDropController, container)
|
|
1118
|
+
);
|
|
1119
|
+
store.add(
|
|
1120
|
+
dndController.onDropTerminal(e => this._onRequestAddInstanceToGroup.fire(e))
|
|
1121
|
+
);
|
|
1122
|
+
store.add(dndController.onDropFile(async path => {
|
|
986
1123
|
this.focus();
|
|
987
1124
|
await this.sendPath(path, false);
|
|
988
1125
|
}));
|
|
@@ -999,10 +1136,12 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
999
1136
|
this.xterm?.raw.clearSelection();
|
|
1000
1137
|
}
|
|
1001
1138
|
_refreshAltBufferContextKey() {
|
|
1002
|
-
this._terminalAltBufferActiveContextKey.set(
|
|
1139
|
+
this._terminalAltBufferActiveContextKey.set(
|
|
1140
|
+
!!(this.xterm && this.xterm.raw.buffer.active === this.xterm.raw.buffer.alternate)
|
|
1141
|
+
);
|
|
1003
1142
|
}
|
|
1004
1143
|
dispose(reason) {
|
|
1005
|
-
if (this.shellLaunchConfig.type ===
|
|
1144
|
+
if (this.shellLaunchConfig.type === "Task" && reason === TerminalExitReason.Process && this._exitCode !== 0 && !this.shellLaunchConfig.waitOnExit) {
|
|
1006
1145
|
return;
|
|
1007
1146
|
}
|
|
1008
1147
|
if (this.isDisposed) {
|
|
@@ -1022,9 +1161,8 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1022
1161
|
}
|
|
1023
1162
|
try {
|
|
1024
1163
|
this.xterm?.dispose();
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
this._logService.error('Exception occurred during xterm disposal', err);
|
|
1164
|
+
} catch (err) {
|
|
1165
|
+
this._logService.error("Exception occurred during xterm disposal", err);
|
|
1028
1166
|
}
|
|
1029
1167
|
if (isFirefox) {
|
|
1030
1168
|
this.resetFocusContextKey();
|
|
@@ -1066,11 +1204,11 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1066
1204
|
if (bracketedPasteMode && this.xterm?.raw.modes.bracketedPasteMode) {
|
|
1067
1205
|
text = `\x1b[200~${text}\x1b[201~`;
|
|
1068
1206
|
}
|
|
1069
|
-
text = text.replace(/\r?\n/g,
|
|
1070
|
-
if (shouldExecute && !text.endsWith(
|
|
1071
|
-
text +=
|
|
1207
|
+
text = text.replace(/\r?\n/g, "\r");
|
|
1208
|
+
if (shouldExecute && !text.endsWith("\r")) {
|
|
1209
|
+
text += "\r";
|
|
1072
1210
|
}
|
|
1073
|
-
this._logService.debug(
|
|
1211
|
+
this._logService.debug("sending data (vscode)", text);
|
|
1074
1212
|
await this._processManager.write(text);
|
|
1075
1213
|
this._onDidInputData.fire(text);
|
|
1076
1214
|
this._onDidSendText.fire(text);
|
|
@@ -1080,7 +1218,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1080
1218
|
}
|
|
1081
1219
|
}
|
|
1082
1220
|
async sendSignal(signal) {
|
|
1083
|
-
this._logService.debug(
|
|
1221
|
+
this._logService.debug("sending signal (vscode)", signal);
|
|
1084
1222
|
await this._processManager.sendSignal(signal);
|
|
1085
1223
|
}
|
|
1086
1224
|
async sendPath(originalPath, shouldExecute) {
|
|
@@ -1088,7 +1226,14 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1088
1226
|
}
|
|
1089
1227
|
async preparePathForShell(originalPath) {
|
|
1090
1228
|
await this.processReady;
|
|
1091
|
-
return preparePathForShell(
|
|
1229
|
+
return preparePathForShell(
|
|
1230
|
+
originalPath,
|
|
1231
|
+
this.shellLaunchConfig.executable,
|
|
1232
|
+
this.title,
|
|
1233
|
+
this.shellType,
|
|
1234
|
+
this._processManager.backend,
|
|
1235
|
+
this._processManager.os
|
|
1236
|
+
);
|
|
1092
1237
|
}
|
|
1093
1238
|
async getUriLabelForShell(uri) {
|
|
1094
1239
|
await this.processReady;
|
|
@@ -1097,7 +1242,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1097
1242
|
setVisible(visible) {
|
|
1098
1243
|
const didChange = this._isVisible !== visible;
|
|
1099
1244
|
this._isVisible = visible;
|
|
1100
|
-
this._wrapperElement.classList.toggle(
|
|
1245
|
+
this._wrapperElement.classList.toggle("active", visible);
|
|
1101
1246
|
if (visible && this.xterm) {
|
|
1102
1247
|
this._open();
|
|
1103
1248
|
this._resizeDebouncer?.flush();
|
|
@@ -1141,11 +1286,19 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1141
1286
|
_createProcessManager() {
|
|
1142
1287
|
let deserializedCollections;
|
|
1143
1288
|
if (this.shellLaunchConfig.attachPersistentProcess?.environmentVariableCollections) {
|
|
1144
|
-
deserializedCollections = deserializeEnvironmentVariableCollections(
|
|
1145
|
-
|
|
1146
|
-
|
|
1289
|
+
deserializedCollections = deserializeEnvironmentVariableCollections(
|
|
1290
|
+
this.shellLaunchConfig.attachPersistentProcess.environmentVariableCollections
|
|
1291
|
+
);
|
|
1292
|
+
}
|
|
1293
|
+
const processManager = this._scopedInstantiationService.createInstance(
|
|
1294
|
+
TerminalProcessManager,
|
|
1295
|
+
this._instanceId,
|
|
1296
|
+
this.shellLaunchConfig?.cwd,
|
|
1297
|
+
deserializedCollections,
|
|
1298
|
+
this.shellLaunchConfig.shellIntegrationNonce ?? this.shellLaunchConfig.attachPersistentProcess?.shellIntegrationNonce
|
|
1299
|
+
);
|
|
1147
1300
|
this.capabilities.add(processManager.capabilities);
|
|
1148
|
-
this._register(processManager.onProcessReady(async
|
|
1301
|
+
this._register(processManager.onProcessReady(async e => {
|
|
1149
1302
|
this._onProcessIdReady.fire(this);
|
|
1150
1303
|
this._initialCwd = await this.getInitialCwd();
|
|
1151
1304
|
if (!this._labelComputer) {
|
|
@@ -1161,8 +1314,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1161
1314
|
}
|
|
1162
1315
|
if (this._shellLaunchConfig.name) {
|
|
1163
1316
|
this._setTitle(this._shellLaunchConfig.name, TitleEventSource.Api);
|
|
1164
|
-
}
|
|
1165
|
-
else {
|
|
1317
|
+
} else {
|
|
1166
1318
|
setTimeout(() => {
|
|
1167
1319
|
this._xtermReadyPromise.then(xterm => {
|
|
1168
1320
|
if (xterm) {
|
|
@@ -1174,45 +1326,57 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1174
1326
|
}
|
|
1175
1327
|
}));
|
|
1176
1328
|
this._register(processManager.onProcessExit(exitCode => this._onProcessExit(exitCode)));
|
|
1177
|
-
this._register(processManager.onDidChangeProperty((
|
|
1329
|
+
this._register(processManager.onDidChangeProperty((
|
|
1330
|
+
{
|
|
1331
|
+
type,
|
|
1332
|
+
value
|
|
1333
|
+
}
|
|
1334
|
+
) => {
|
|
1178
1335
|
switch (type) {
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1336
|
+
case ProcessPropertyType.Cwd:
|
|
1337
|
+
this._cwd = value;
|
|
1338
|
+
this._labelComputer?.refreshLabel(this);
|
|
1339
|
+
break;
|
|
1340
|
+
case ProcessPropertyType.InitialCwd:
|
|
1341
|
+
this._initialCwd = value;
|
|
1342
|
+
this._cwd = this._initialCwd;
|
|
1343
|
+
this._setTitle(this.title, TitleEventSource.Config);
|
|
1344
|
+
this._icon = this._shellLaunchConfig.attachPersistentProcess?.icon || this._shellLaunchConfig.icon;
|
|
1345
|
+
this._onIconChanged.fire({
|
|
1346
|
+
instance: this,
|
|
1347
|
+
userInitiated: false
|
|
1348
|
+
});
|
|
1349
|
+
break;
|
|
1350
|
+
case ProcessPropertyType.Title:
|
|
1351
|
+
this._setTitle(value ?? "", TitleEventSource.Process);
|
|
1352
|
+
break;
|
|
1353
|
+
case ProcessPropertyType.OverrideDimensions:
|
|
1354
|
+
this.setOverrideDimensions(value, true);
|
|
1355
|
+
break;
|
|
1356
|
+
case ProcessPropertyType.ResolvedShellLaunchConfig:
|
|
1357
|
+
this._setResolvedShellLaunchConfig(value);
|
|
1358
|
+
break;
|
|
1359
|
+
case ProcessPropertyType.ShellType:
|
|
1360
|
+
this.setShellType(value);
|
|
1361
|
+
break;
|
|
1362
|
+
case ProcessPropertyType.HasChildProcesses:
|
|
1363
|
+
this._onDidChangeHasChildProcesses.fire(value);
|
|
1364
|
+
break;
|
|
1365
|
+
case ProcessPropertyType.UsedShellIntegrationInjection:
|
|
1366
|
+
this._usedShellIntegrationInjection = true;
|
|
1367
|
+
break;
|
|
1368
|
+
case ProcessPropertyType.ShellIntegrationInjectionFailureReason:
|
|
1369
|
+
this._shellIntegrationInjectionInfo = value;
|
|
1370
|
+
break;
|
|
1211
1371
|
}
|
|
1212
1372
|
}));
|
|
1213
1373
|
this._initialDataEventsListener.value = processManager.onProcessData(ev => this._initialDataEvents?.push(ev.data));
|
|
1214
|
-
this._register(
|
|
1215
|
-
|
|
1374
|
+
this._register(
|
|
1375
|
+
processManager.onProcessReplayComplete(() => this._onProcessReplayComplete.fire())
|
|
1376
|
+
);
|
|
1377
|
+
this._register(
|
|
1378
|
+
processManager.onEnvironmentVariableInfoChanged(e => this._onEnvironmentVariableInfoChanged(e))
|
|
1379
|
+
);
|
|
1216
1380
|
this._register(processManager.onPtyDisconnect(() => {
|
|
1217
1381
|
if (this.xterm) {
|
|
1218
1382
|
this.xterm.raw.options.disableStdin = true;
|
|
@@ -1221,7 +1385,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1221
1385
|
id: TerminalStatus.Disconnected,
|
|
1222
1386
|
severity: Severity.Error,
|
|
1223
1387
|
icon: Codicon.debugDisconnect,
|
|
1224
|
-
tooltip: ( localize(
|
|
1388
|
+
tooltip: ( localize(11912, "Lost connection to process"))
|
|
1225
1389
|
});
|
|
1226
1390
|
}));
|
|
1227
1391
|
this._register(processManager.onPtyReconnect(() => {
|
|
@@ -1238,12 +1402,13 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1238
1402
|
}
|
|
1239
1403
|
const trusted = await this._trust();
|
|
1240
1404
|
if (!trusted && !this.remoteAuthority && !this._workbenchEnvironmentService.remoteAuthority) {
|
|
1241
|
-
this._onProcessExit({
|
|
1242
|
-
|
|
1243
|
-
|
|
1405
|
+
this._onProcessExit({
|
|
1406
|
+
message: ( localize(11913, "Cannot launch a terminal process in an untrusted workspace"))
|
|
1407
|
+
});
|
|
1408
|
+
} else if (this._workspaceContextService.getWorkspace().folders.length === 0 && this._cwd && this._userHome && this._cwd !== this._userHome) {
|
|
1244
1409
|
this._onProcessExit({
|
|
1245
1410
|
message: ( localize(
|
|
1246
|
-
|
|
1411
|
+
11914,
|
|
1247
1412
|
"Cannot launch a terminal process in an untrusted workspace with cwd {0} and userHome {1}",
|
|
1248
1413
|
this._cwd,
|
|
1249
1414
|
this._userHome
|
|
@@ -1255,12 +1420,19 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1255
1420
|
this.xterm?.resize(this._cols || Constants.DefaultCols, this._rows || Constants.DefaultRows);
|
|
1256
1421
|
}
|
|
1257
1422
|
const originalIcon = this.shellLaunchConfig.icon;
|
|
1258
|
-
await this._processManager.createProcess(
|
|
1423
|
+
await this._processManager.createProcess(
|
|
1424
|
+
this._shellLaunchConfig,
|
|
1425
|
+
this._cols || Constants.DefaultCols,
|
|
1426
|
+
this._rows || Constants.DefaultRows
|
|
1427
|
+
).then(result => {
|
|
1259
1428
|
if (result) {
|
|
1260
|
-
if (hasKey(result, {
|
|
1429
|
+
if (hasKey(result, {
|
|
1430
|
+
message: true
|
|
1431
|
+
})) {
|
|
1261
1432
|
this._onProcessExit(result);
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1433
|
+
} else if (hasKey(result, {
|
|
1434
|
+
injectedArgs: true
|
|
1435
|
+
})) {
|
|
1264
1436
|
this._injectedArgs = result.injectedArgs;
|
|
1265
1437
|
}
|
|
1266
1438
|
}
|
|
@@ -1270,7 +1442,10 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1270
1442
|
}
|
|
1271
1443
|
if (originalIcon !== this.shellLaunchConfig.icon || this.shellLaunchConfig.color) {
|
|
1272
1444
|
this._icon = this._shellLaunchConfig.attachPersistentProcess?.icon || this._shellLaunchConfig.icon;
|
|
1273
|
-
this._onIconChanged.fire({
|
|
1445
|
+
this._onIconChanged.fire({
|
|
1446
|
+
instance: this,
|
|
1447
|
+
userInitiated: false
|
|
1448
|
+
});
|
|
1274
1449
|
}
|
|
1275
1450
|
}
|
|
1276
1451
|
registerMarker(offset) {
|
|
@@ -1292,10 +1467,10 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1292
1467
|
let i = 0;
|
|
1293
1468
|
for (const match of matches) {
|
|
1294
1469
|
if (match.groups?.seq === undefined) {
|
|
1295
|
-
throw ( new BugIndicatingError(
|
|
1470
|
+
throw ( new BugIndicatingError("seq must be defined"));
|
|
1296
1471
|
}
|
|
1297
1472
|
leadingSegmentedData.push(ev.data.substring(i, match.index));
|
|
1298
|
-
leadingSegmentedData.push(match.groups?.seq ??
|
|
1473
|
+
leadingSegmentedData.push(match.groups?.seq ?? "");
|
|
1299
1474
|
i = match.index + match[0].length;
|
|
1300
1475
|
}
|
|
1301
1476
|
const lastData = ev.data.substring(i);
|
|
@@ -1304,8 +1479,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1304
1479
|
}
|
|
1305
1480
|
if (ev.trackCommit) {
|
|
1306
1481
|
ev.writePromise = ( new Promise(r => this._writeProcessData(lastData, r)));
|
|
1307
|
-
}
|
|
1308
|
-
else {
|
|
1482
|
+
} else {
|
|
1309
1483
|
this._writeProcessData(lastData);
|
|
1310
1484
|
}
|
|
1311
1485
|
}
|
|
@@ -1323,7 +1497,12 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1323
1497
|
if (this._isExiting) {
|
|
1324
1498
|
return;
|
|
1325
1499
|
}
|
|
1326
|
-
const parsedExitResult = parseExitResult(
|
|
1500
|
+
const parsedExitResult = parseExitResult(
|
|
1501
|
+
exitCodeOrError,
|
|
1502
|
+
this.shellLaunchConfig,
|
|
1503
|
+
this._processManager.processState,
|
|
1504
|
+
this._initialCwd
|
|
1505
|
+
);
|
|
1327
1506
|
if (this._usedShellIntegrationInjection && this._processManager.processState === ProcessState.KilledDuringLaunch && parsedExitResult?.code !== 0) {
|
|
1328
1507
|
this._relaunchWithShellIntegrationDisabled(parsedExitResult?.message);
|
|
1329
1508
|
this._onExit.fire(exitCodeOrError);
|
|
@@ -1333,7 +1512,15 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1333
1512
|
await this._flushXtermData();
|
|
1334
1513
|
this._exitCode = parsedExitResult?.code;
|
|
1335
1514
|
const exitMessage = parsedExitResult?.message;
|
|
1336
|
-
this._logService.debug(
|
|
1515
|
+
this._logService.debug(
|
|
1516
|
+
"Terminal process exit",
|
|
1517
|
+
"instanceId",
|
|
1518
|
+
this.instanceId,
|
|
1519
|
+
"code",
|
|
1520
|
+
this._exitCode,
|
|
1521
|
+
"processState",
|
|
1522
|
+
this._processManager.processState
|
|
1523
|
+
);
|
|
1337
1524
|
const waitOnExit = this.waitOnExit;
|
|
1338
1525
|
if (waitOnExit && this._processManager.processState !== ProcessState.KilledByUser) {
|
|
1339
1526
|
this._xtermReadyPromise.then(xterm => {
|
|
@@ -1344,32 +1531,36 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1344
1531
|
xterm.raw.write(formatMessageForTerminal(exitMessage));
|
|
1345
1532
|
}
|
|
1346
1533
|
switch (typeof waitOnExit) {
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1534
|
+
case "string":
|
|
1535
|
+
xterm.raw.write(formatMessageForTerminal(waitOnExit, {
|
|
1536
|
+
excludeLeadingNewLine: true
|
|
1537
|
+
}));
|
|
1538
|
+
break;
|
|
1539
|
+
case "function":
|
|
1540
|
+
if (this.exitCode !== undefined) {
|
|
1541
|
+
xterm.raw.write(formatMessageForTerminal(waitOnExit(this.exitCode), {
|
|
1542
|
+
excludeLeadingNewLine: true
|
|
1543
|
+
}));
|
|
1544
|
+
}
|
|
1545
|
+
break;
|
|
1355
1546
|
}
|
|
1356
1547
|
xterm.raw.options.disableStdin = true;
|
|
1357
1548
|
if (xterm.raw.textarea) {
|
|
1358
1549
|
this._attachPressAnyKeyToCloseListener(xterm.raw);
|
|
1359
1550
|
}
|
|
1360
1551
|
});
|
|
1361
|
-
}
|
|
1362
|
-
else {
|
|
1552
|
+
} else {
|
|
1363
1553
|
if (exitMessage) {
|
|
1364
1554
|
const failedDuringLaunch = this._processManager.processState === ProcessState.KilledDuringLaunch;
|
|
1365
|
-
if (failedDuringLaunch || (this._terminalConfigurationService.config.showExitAlert && this.xterm?.lastInputEvent !==
|
|
1555
|
+
if (failedDuringLaunch || (this._terminalConfigurationService.config.showExitAlert && this.xterm?.lastInputEvent !== "\u0004")) {
|
|
1366
1556
|
this._notificationService.notify({
|
|
1367
1557
|
message: exitMessage,
|
|
1368
1558
|
severity: Severity.Error,
|
|
1369
|
-
actions: {
|
|
1559
|
+
actions: {
|
|
1560
|
+
primary: [this._scopedInstantiationService.createInstance(TerminalLaunchHelpAction)]
|
|
1561
|
+
}
|
|
1370
1562
|
});
|
|
1371
|
-
}
|
|
1372
|
-
else {
|
|
1563
|
+
} else {
|
|
1373
1564
|
this._logService.warn(exitMessage);
|
|
1374
1565
|
}
|
|
1375
1566
|
}
|
|
@@ -1387,22 +1578,27 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1387
1578
|
id: TerminalStatus.ShellIntegrationAttentionNeeded,
|
|
1388
1579
|
severity: Severity.Warning,
|
|
1389
1580
|
icon: Codicon.warning,
|
|
1390
|
-
tooltip: `${exitMessage} ` + ( localize(
|
|
1581
|
+
tooltip: `${exitMessage} ` + ( localize(11915, "Disabling shell integration in user settings might help.")),
|
|
1391
1582
|
hoverActions: [{
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1583
|
+
commandId: TerminalCommandId.ShellIntegrationLearnMore,
|
|
1584
|
+
label: ( localize(11916, "Learn more about shell integration")),
|
|
1585
|
+
run: () => {
|
|
1586
|
+
this._openerService.open(
|
|
1587
|
+
"https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration"
|
|
1588
|
+
);
|
|
1589
|
+
}
|
|
1590
|
+
}, {
|
|
1591
|
+
commandId: "workbench.action.openSettings",
|
|
1592
|
+
label: ( localize(11917, "Open user settings")),
|
|
1593
|
+
run: () => {
|
|
1594
|
+
this._commandService.executeCommand(
|
|
1595
|
+
"workbench.action.openSettings",
|
|
1596
|
+
"terminal.integrated.shellIntegration.enabled"
|
|
1597
|
+
);
|
|
1598
|
+
}
|
|
1599
|
+
}]
|
|
1404
1600
|
});
|
|
1405
|
-
this._telemetryService.publicLog2(
|
|
1601
|
+
this._telemetryService.publicLog2("terminal/shellIntegrationFailureProcessExit");
|
|
1406
1602
|
}
|
|
1407
1603
|
_flushXtermData() {
|
|
1408
1604
|
if (this._latestXtermWriteData === this._latestXtermParseData) {
|
|
@@ -1420,7 +1616,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1420
1616
|
}
|
|
1421
1617
|
_attachPressAnyKeyToCloseListener(xterm) {
|
|
1422
1618
|
if (xterm.textarea && !this._pressAnyKeyToCloseListener) {
|
|
1423
|
-
this._pressAnyKeyToCloseListener = addDisposableListener(xterm.textarea,
|
|
1619
|
+
this._pressAnyKeyToCloseListener = addDisposableListener(xterm.textarea, "keypress", event => {
|
|
1424
1620
|
if (this._pressAnyKeyToCloseListener) {
|
|
1425
1621
|
this._pressAnyKeyToCloseListener.dispose();
|
|
1426
1622
|
this._pressAnyKeyToCloseListener = undefined;
|
|
@@ -1435,17 +1631,13 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1435
1631
|
callback?.();
|
|
1436
1632
|
return;
|
|
1437
1633
|
}
|
|
1438
|
-
const text = isString(this._shellLaunchConfig.initialText)
|
|
1439
|
-
? this._shellLaunchConfig.initialText
|
|
1440
|
-
: this._shellLaunchConfig.initialText?.text;
|
|
1634
|
+
const text = isString(this._shellLaunchConfig.initialText) ? this._shellLaunchConfig.initialText : this._shellLaunchConfig.initialText?.text;
|
|
1441
1635
|
if (isString(this._shellLaunchConfig.initialText)) {
|
|
1442
1636
|
xterm.raw.writeln(text, callback);
|
|
1443
|
-
}
|
|
1444
|
-
else {
|
|
1637
|
+
} else {
|
|
1445
1638
|
if (this._shellLaunchConfig.initialText.trailingNewLine) {
|
|
1446
1639
|
xterm.raw.writeln(text, callback);
|
|
1447
|
-
}
|
|
1448
|
-
else {
|
|
1640
|
+
} else {
|
|
1449
1641
|
xterm.raw.write(text, callback);
|
|
1450
1642
|
}
|
|
1451
1643
|
}
|
|
@@ -1456,7 +1648,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1456
1648
|
const xterm = this.xterm;
|
|
1457
1649
|
if (xterm) {
|
|
1458
1650
|
if (!reset) {
|
|
1459
|
-
await ( new Promise(r => xterm.raw.write(
|
|
1651
|
+
await ( new Promise(r => xterm.raw.write("\n\u001b[G", r)));
|
|
1460
1652
|
}
|
|
1461
1653
|
if (shell.initialText) {
|
|
1462
1654
|
this._shellLaunchConfig.initialText = shell.initialText;
|
|
@@ -1472,22 +1664,32 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1472
1664
|
}
|
|
1473
1665
|
this.statusList.remove(TerminalStatus.RelaunchNeeded);
|
|
1474
1666
|
if (!reset) {
|
|
1475
|
-
shell.initialText =
|
|
1667
|
+
shell.initialText = " ";
|
|
1476
1668
|
}
|
|
1477
1669
|
this._shellLaunchConfig = shell;
|
|
1478
|
-
await this._processManager.relaunch(
|
|
1670
|
+
await this._processManager.relaunch(
|
|
1671
|
+
this._shellLaunchConfig,
|
|
1672
|
+
this._cols || Constants.DefaultCols,
|
|
1673
|
+
this._rows || Constants.DefaultRows,
|
|
1674
|
+
reset
|
|
1675
|
+
).then(result => {
|
|
1479
1676
|
if (result) {
|
|
1480
|
-
if (hasKey(result, {
|
|
1677
|
+
if (hasKey(result, {
|
|
1678
|
+
message: true
|
|
1679
|
+
})) {
|
|
1481
1680
|
this._onProcessExit(result);
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1681
|
+
} else if (hasKey(result, {
|
|
1682
|
+
injectedArgs: true
|
|
1683
|
+
})) {
|
|
1484
1684
|
this._injectedArgs = result.injectedArgs;
|
|
1485
1685
|
}
|
|
1486
1686
|
}
|
|
1487
1687
|
});
|
|
1488
1688
|
}
|
|
1489
1689
|
relaunch() {
|
|
1490
|
-
const shellLaunchConfig = {
|
|
1690
|
+
const shellLaunchConfig = {
|
|
1691
|
+
...this._shellLaunchConfig
|
|
1692
|
+
};
|
|
1491
1693
|
delete shellLaunchConfig.attachPersistentProcess;
|
|
1492
1694
|
this.reuseTerminal(shellLaunchConfig, true);
|
|
1493
1695
|
}
|
|
@@ -1497,9 +1699,16 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1497
1699
|
}
|
|
1498
1700
|
}
|
|
1499
1701
|
async _trust() {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1702
|
+
if (this._configurationService.getValue(TerminalSettingId.AllowInUntrustedWorkspace)) {
|
|
1703
|
+
this._logService.info(
|
|
1704
|
+
`Workspace trust check bypassed due to ${TerminalSettingId.AllowInUntrustedWorkspace}`
|
|
1705
|
+
);
|
|
1706
|
+
return true;
|
|
1707
|
+
}
|
|
1708
|
+
const trustRequest = await this._workspaceTrustRequestService.requestWorkspaceTrust({
|
|
1709
|
+
message: ( localize(11918, "Creating a terminal process requires executing code"))
|
|
1710
|
+
});
|
|
1711
|
+
return trustRequest === true;
|
|
1503
1712
|
}
|
|
1504
1713
|
async _updateProcessCwd() {
|
|
1505
1714
|
if (this.isDisposed || this.shellLaunchConfig.customPtyImplementation) {
|
|
@@ -1510,9 +1719,8 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1510
1719
|
if (!isString(cwd)) {
|
|
1511
1720
|
throw ( new Error(`cwd is not a string ${cwd}`));
|
|
1512
1721
|
}
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
if (e instanceof Error && e.message === 'Cannot refresh property when process is not set') {
|
|
1722
|
+
} catch (e) {
|
|
1723
|
+
if (e instanceof Error && e.message === "Cannot refresh property when process is not set") {
|
|
1516
1724
|
return;
|
|
1517
1725
|
}
|
|
1518
1726
|
throw e;
|
|
@@ -1529,7 +1737,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1529
1737
|
this.xterm.raw.options.screenReaderMode = this._accessibilityService.isScreenReaderOptimized();
|
|
1530
1738
|
}
|
|
1531
1739
|
_setCommandsToSkipShell(commands) {
|
|
1532
|
-
const excludeCommands = ( commands.filter(command => command[0] ===
|
|
1740
|
+
const excludeCommands = ( commands.filter(command => command[0] === "-").map(command => command.slice(1)));
|
|
1533
1741
|
this._skipTerminalCommands = DEFAULT_COMMANDS_TO_SKIP_SHELL.filter(defaultCommand => {
|
|
1534
1742
|
return !excludeCommands.includes(defaultCommand);
|
|
1535
1743
|
}).concat(commands);
|
|
@@ -1557,8 +1765,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1557
1765
|
contribution.layout?.(xterm, dimension);
|
|
1558
1766
|
}
|
|
1559
1767
|
});
|
|
1560
|
-
}
|
|
1561
|
-
else {
|
|
1768
|
+
} else {
|
|
1562
1769
|
contribution.layout?.(this.xterm, dimension);
|
|
1563
1770
|
}
|
|
1564
1771
|
}
|
|
@@ -1588,11 +1795,17 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1588
1795
|
}
|
|
1589
1796
|
if (cols !== this.xterm.raw.cols || rows !== this.xterm.raw.rows) {
|
|
1590
1797
|
if (this._fixedRows || this._fixedCols) {
|
|
1591
|
-
await this._updateProperty(ProcessPropertyType.FixedDimensions, {
|
|
1798
|
+
await this._updateProperty(ProcessPropertyType.FixedDimensions, {
|
|
1799
|
+
cols: this._fixedCols,
|
|
1800
|
+
rows: this._fixedRows
|
|
1801
|
+
});
|
|
1592
1802
|
}
|
|
1593
1803
|
this._onDimensionsChanged.fire();
|
|
1594
1804
|
}
|
|
1595
|
-
TerminalInstance_1._lastKnownGridDimensions = {
|
|
1805
|
+
TerminalInstance_1._lastKnownGridDimensions = {
|
|
1806
|
+
cols,
|
|
1807
|
+
rows
|
|
1808
|
+
};
|
|
1596
1809
|
this._resizeDebouncer.resize(cols, rows, immediate ?? false);
|
|
1597
1810
|
}
|
|
1598
1811
|
async _updatePtyDimensions(rawXterm) {
|
|
@@ -1605,8 +1818,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1605
1818
|
this._shellType = shellType;
|
|
1606
1819
|
if (shellType === undefined) {
|
|
1607
1820
|
this._terminalShellTypeContextKey.reset();
|
|
1608
|
-
}
|
|
1609
|
-
else {
|
|
1821
|
+
} else {
|
|
1610
1822
|
this._terminalShellTypeContextKey.set(shellType?.toString());
|
|
1611
1823
|
}
|
|
1612
1824
|
this._onDidChangeShellType.fire(shellType);
|
|
@@ -1615,27 +1827,26 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1615
1827
|
const labelParts = [];
|
|
1616
1828
|
if (xterm && xterm.textarea) {
|
|
1617
1829
|
if (title && title.length > 0) {
|
|
1618
|
-
labelParts.push(( localize(
|
|
1619
|
-
}
|
|
1620
|
-
|
|
1621
|
-
labelParts.push(( localize(11596, "Terminal {0}", terminalId)));
|
|
1830
|
+
labelParts.push(( localize(11919, "Terminal {0}, {1}", terminalId, title)));
|
|
1831
|
+
} else {
|
|
1832
|
+
labelParts.push(( localize(11920, "Terminal {0}", terminalId)));
|
|
1622
1833
|
}
|
|
1623
1834
|
const screenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();
|
|
1624
1835
|
if (!screenReaderOptimized) {
|
|
1625
1836
|
labelParts.push(( localize(
|
|
1626
|
-
|
|
1837
|
+
11921,
|
|
1627
1838
|
"Run the command: Toggle Screen Reader Accessibility Mode for an optimized screen reader experience"
|
|
1628
1839
|
)));
|
|
1629
1840
|
}
|
|
1630
1841
|
const accessibilityHelpKeybinding = this._keybindingService.lookupKeybinding(AccessibilityCommandId.OpenAccessibilityHelp)?.getLabel();
|
|
1631
1842
|
if (this._configurationService.getValue(AccessibilityVerbositySettingId.Terminal) && accessibilityHelpKeybinding) {
|
|
1632
1843
|
labelParts.push(( localize(
|
|
1633
|
-
|
|
1844
|
+
11922,
|
|
1634
1845
|
"Use {0} for terminal accessibility help",
|
|
1635
1846
|
accessibilityHelpKeybinding
|
|
1636
1847
|
)));
|
|
1637
1848
|
}
|
|
1638
|
-
xterm.textarea.setAttribute(
|
|
1849
|
+
xterm.textarea.setAttribute("aria-label", labelParts.join("\n"));
|
|
1639
1850
|
}
|
|
1640
1851
|
}
|
|
1641
1852
|
_updateTitleProperties(title, eventSource) {
|
|
@@ -1643,32 +1854,29 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1643
1854
|
return this._processName;
|
|
1644
1855
|
}
|
|
1645
1856
|
switch (eventSource) {
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
else if (firstSpaceIndex > -1) {
|
|
1656
|
-
title = title.substring(0, firstSpaceIndex);
|
|
1657
|
-
}
|
|
1658
|
-
}
|
|
1659
|
-
this._processName = title;
|
|
1660
|
-
break;
|
|
1661
|
-
case TitleEventSource.Api:
|
|
1662
|
-
this._staticTitle = title;
|
|
1663
|
-
this._messageTitleDisposable.value = undefined;
|
|
1664
|
-
break;
|
|
1665
|
-
case TitleEventSource.Sequence:
|
|
1666
|
-
this._sequence = title;
|
|
1667
|
-
if (this._processManager.os === OperatingSystem.Windows &&
|
|
1668
|
-
title.match(/^[a-zA-Z]:\\.+\.[a-zA-Z]{1,3}/)) {
|
|
1669
|
-
this._sequence = win32.parse(title).name;
|
|
1857
|
+
case TitleEventSource.Process:
|
|
1858
|
+
if (this._processManager.os === OperatingSystem.Windows) {
|
|
1859
|
+
title = win32.parse(title).name;
|
|
1860
|
+
} else {
|
|
1861
|
+
const firstSpaceIndex = title.indexOf(" ");
|
|
1862
|
+
if (title.startsWith("/")) {
|
|
1863
|
+
title = basename(title);
|
|
1864
|
+
} else if (firstSpaceIndex > -1) {
|
|
1865
|
+
title = title.substring(0, firstSpaceIndex);
|
|
1670
1866
|
}
|
|
1671
|
-
|
|
1867
|
+
}
|
|
1868
|
+
this._processName = title;
|
|
1869
|
+
break;
|
|
1870
|
+
case TitleEventSource.Api:
|
|
1871
|
+
this._staticTitle = title;
|
|
1872
|
+
this._messageTitleDisposable.value = undefined;
|
|
1873
|
+
break;
|
|
1874
|
+
case TitleEventSource.Sequence:
|
|
1875
|
+
this._sequence = title;
|
|
1876
|
+
if (this._processManager.os === OperatingSystem.Windows && title.match(/^[a-zA-Z]:\\.+\.[a-zA-Z]{1,3}/)) {
|
|
1877
|
+
this._sequence = win32.parse(title).name;
|
|
1878
|
+
}
|
|
1879
|
+
break;
|
|
1672
1880
|
}
|
|
1673
1881
|
this._titleSource = eventSource;
|
|
1674
1882
|
return title;
|
|
@@ -1681,16 +1889,18 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1681
1889
|
this._dimensionsOverride = dimensions;
|
|
1682
1890
|
if (immediate) {
|
|
1683
1891
|
this._resize(true);
|
|
1684
|
-
}
|
|
1685
|
-
else {
|
|
1892
|
+
} else {
|
|
1686
1893
|
this._resize();
|
|
1687
1894
|
}
|
|
1688
1895
|
}
|
|
1689
1896
|
async setFixedDimensions() {
|
|
1690
1897
|
const cols = await this._quickInputService.input({
|
|
1691
|
-
title: ( localize(
|
|
1692
|
-
placeHolder:
|
|
1693
|
-
validateInput: async
|
|
1898
|
+
title: ( localize(11923, "Set Fixed Dimensions: Column")),
|
|
1899
|
+
placeHolder: "Enter a number of columns or leave empty for automatic width",
|
|
1900
|
+
validateInput: async text => text.length > 0 && !text.match(/^\d+$/) ? {
|
|
1901
|
+
content: "Enter a number or leave empty size automatically",
|
|
1902
|
+
severity: Severity.Error
|
|
1903
|
+
} : undefined
|
|
1694
1904
|
});
|
|
1695
1905
|
if (cols === undefined) {
|
|
1696
1906
|
return;
|
|
@@ -1699,9 +1909,12 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1699
1909
|
this._labelComputer?.refreshLabel(this);
|
|
1700
1910
|
this._terminalHasFixedWidth.set(!!this._fixedCols);
|
|
1701
1911
|
const rows = await this._quickInputService.input({
|
|
1702
|
-
title: ( localize(
|
|
1703
|
-
placeHolder:
|
|
1704
|
-
validateInput: async
|
|
1912
|
+
title: ( localize(11924, "Set Fixed Dimensions: Row")),
|
|
1913
|
+
placeHolder: "Enter a number of rows or leave empty for automatic height",
|
|
1914
|
+
validateInput: async text => text.length > 0 && !text.match(/^\d+$/) ? {
|
|
1915
|
+
content: "Enter a number or leave empty size automatically",
|
|
1916
|
+
severity: Severity.Error
|
|
1917
|
+
} : undefined
|
|
1705
1918
|
});
|
|
1706
1919
|
if (rows === undefined) {
|
|
1707
1920
|
return;
|
|
@@ -1713,7 +1926,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1713
1926
|
this.focus();
|
|
1714
1927
|
}
|
|
1715
1928
|
_parseFixedDimension(value) {
|
|
1716
|
-
if (value ===
|
|
1929
|
+
if (value === "") {
|
|
1717
1930
|
return undefined;
|
|
1718
1931
|
}
|
|
1719
1932
|
const parsed = parseInt(value);
|
|
@@ -1733,11 +1946,13 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1733
1946
|
this._hasScrollBar = false;
|
|
1734
1947
|
this._initDimensions();
|
|
1735
1948
|
await this._resize();
|
|
1736
|
-
}
|
|
1737
|
-
else {
|
|
1949
|
+
} else {
|
|
1738
1950
|
const font = this.xterm ? this.xterm.getFont() : this._terminalConfigurationService.getFont(getWindow(this.domElement));
|
|
1739
1951
|
const maxColsForTexture = Math.floor(Constants.MaxCanvasWidth / (font.charWidth ?? 20));
|
|
1740
|
-
const proposedCols = Math.max(
|
|
1952
|
+
const proposedCols = Math.max(
|
|
1953
|
+
this.maxCols,
|
|
1954
|
+
Math.min(this.xterm.getLongestViewportWrappedLineLength(), maxColsForTexture)
|
|
1955
|
+
);
|
|
1741
1956
|
if (proposedCols > this.xterm.raw.cols) {
|
|
1742
1957
|
this._fixedCols = proposedCols;
|
|
1743
1958
|
}
|
|
@@ -1757,7 +1972,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1757
1972
|
if (!this.xterm?.raw.element || !this._container || !charWidth || !this._fixedCols) {
|
|
1758
1973
|
return;
|
|
1759
1974
|
}
|
|
1760
|
-
this._wrapperElement.classList.add(
|
|
1975
|
+
this._wrapperElement.classList.add("fixed-dims");
|
|
1761
1976
|
this._hasScrollBar = true;
|
|
1762
1977
|
this._initDimensions();
|
|
1763
1978
|
await this._resize();
|
|
@@ -1776,7 +1991,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1776
1991
|
width: this.xterm.raw.element.clientWidth,
|
|
1777
1992
|
scrollWidth: this._fixedCols * charWidth + 40
|
|
1778
1993
|
});
|
|
1779
|
-
this._horizontalScrollbar.getDomNode().style.paddingBottom =
|
|
1994
|
+
this._horizontalScrollbar.getDomNode().style.paddingBottom = "16px";
|
|
1780
1995
|
if (isWindows) {
|
|
1781
1996
|
for (let i = this.xterm.raw.buffer.active.viewportY; i < this.xterm.raw.buffer.active.length; i++) {
|
|
1782
1997
|
const line = this.xterm.raw.buffer.active.getLine(i);
|
|
@@ -1792,7 +2007,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1792
2007
|
this._horizontalScrollbar.dispose();
|
|
1793
2008
|
this._horizontalScrollbar = undefined;
|
|
1794
2009
|
this._wrapperElement.remove();
|
|
1795
|
-
this._wrapperElement.classList.remove(
|
|
2010
|
+
this._wrapperElement.classList.remove("fixed-dims");
|
|
1796
2011
|
this._container.appendChild(this._wrapperElement);
|
|
1797
2012
|
}
|
|
1798
2013
|
_setResolvedShellLaunchConfig(shellLaunchConfig) {
|
|
@@ -1803,8 +2018,8 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1803
2018
|
}
|
|
1804
2019
|
_onEnvironmentVariableInfoChanged(info) {
|
|
1805
2020
|
if (info.requiresAction) {
|
|
1806
|
-
this.xterm?.raw.textarea?.setAttribute(
|
|
1807
|
-
|
|
2021
|
+
this.xterm?.raw.textarea?.setAttribute("aria-label", ( localize(
|
|
2022
|
+
11925,
|
|
1808
2023
|
"Terminal {0} environment is stale, run the 'Show Environment Information' command for more information",
|
|
1809
2024
|
this._instanceId
|
|
1810
2025
|
)));
|
|
@@ -1819,18 +2034,23 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1819
2034
|
}
|
|
1820
2035
|
if (
|
|
1821
2036
|
info.requiresAction &&
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
!(this._processManager.remoteAuthority && this._terminalConfigurationService.config.windowsEnableConpty && (await this._processManager.getBackendOS()) === OperatingSystem.Windows)) {
|
|
2037
|
+
this._terminalConfigurationService.config.environmentChangesRelaunch &&
|
|
2038
|
+
!this._processManager.hasWrittenData && (!this._shellLaunchConfig.isFeatureTerminal || (this.reconnectionProperties && this._configurationService.getValue("task.reconnection") === true)) &&
|
|
2039
|
+
!this._shellLaunchConfig.customPtyImplementation &&
|
|
2040
|
+
!this._shellLaunchConfig.isExtensionOwnedTerminal &&
|
|
2041
|
+
!this._shellLaunchConfig.attachPersistentProcess &&
|
|
2042
|
+
!(this._processManager.remoteAuthority && (await this._processManager.getBackendOS()) === OperatingSystem.Windows && this._processManager.processTraits?.windowsPty?.buildNumber && this._processManager.processTraits.windowsPty.buildNumber >= 18309)) {
|
|
1829
2043
|
this.relaunch();
|
|
1830
2044
|
return;
|
|
1831
2045
|
}
|
|
1832
|
-
const workspaceFolder = getWorkspaceForTerminal(
|
|
1833
|
-
|
|
2046
|
+
const workspaceFolder = getWorkspaceForTerminal(
|
|
2047
|
+
this.shellLaunchConfig.cwd,
|
|
2048
|
+
this._workspaceContextService,
|
|
2049
|
+
this._historyService
|
|
2050
|
+
);
|
|
2051
|
+
this.statusList.add(info.getStatus({
|
|
2052
|
+
workspaceFolder
|
|
2053
|
+
}));
|
|
1834
2054
|
}
|
|
1835
2055
|
async getInitialCwd() {
|
|
1836
2056
|
if (!this._initialCwd) {
|
|
@@ -1841,8 +2061,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1841
2061
|
async getSpeculativeCwd() {
|
|
1842
2062
|
if (( this.capabilities.has(TerminalCapability.CwdDetection))) {
|
|
1843
2063
|
return this.capabilities.get(TerminalCapability.CwdDetection).getCwd();
|
|
1844
|
-
}
|
|
1845
|
-
else if (( this.capabilities.has(TerminalCapability.NaiveCwdDetection))) {
|
|
2064
|
+
} else if (( this.capabilities.has(TerminalCapability.NaiveCwdDetection))) {
|
|
1846
2065
|
return this.capabilities.get(TerminalCapability.NaiveCwdDetection).getCwd();
|
|
1847
2066
|
}
|
|
1848
2067
|
return this._processManager.initialCwd;
|
|
@@ -1855,8 +2074,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1855
2074
|
let resource;
|
|
1856
2075
|
if (this.remoteAuthority) {
|
|
1857
2076
|
resource = await this._pathService.fileURI(cwd);
|
|
1858
|
-
}
|
|
1859
|
-
else {
|
|
2077
|
+
} else {
|
|
1860
2078
|
resource = URI.file(cwd);
|
|
1861
2079
|
}
|
|
1862
2080
|
if (await this._fileService.exists(resource)) {
|
|
@@ -1875,7 +2093,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1875
2093
|
this._setTitle(title, source ?? TitleEventSource.Api);
|
|
1876
2094
|
}
|
|
1877
2095
|
_setTitle(title, eventSource) {
|
|
1878
|
-
if ((this._shellLaunchConfig?.type ===
|
|
2096
|
+
if ((this._shellLaunchConfig?.type === "Task" || this._titleSource === TitleEventSource.Api) && eventSource === TitleEventSource.Process) {
|
|
1879
2097
|
return;
|
|
1880
2098
|
}
|
|
1881
2099
|
const reset = !title;
|
|
@@ -1891,7 +2109,10 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1891
2109
|
async changeIcon(icon) {
|
|
1892
2110
|
if (icon) {
|
|
1893
2111
|
this._icon = icon;
|
|
1894
|
-
this._onIconChanged.fire({
|
|
2112
|
+
this._onIconChanged.fire({
|
|
2113
|
+
instance: this,
|
|
2114
|
+
userInitiated: true
|
|
2115
|
+
});
|
|
1895
2116
|
return icon;
|
|
1896
2117
|
}
|
|
1897
2118
|
const iconPicker = this._scopedInstantiationService.createInstance(TerminalIconPicker);
|
|
@@ -1901,18 +2122,26 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1901
2122
|
return undefined;
|
|
1902
2123
|
}
|
|
1903
2124
|
this._icon = pickedIcon;
|
|
1904
|
-
this._onIconChanged.fire({
|
|
2125
|
+
this._onIconChanged.fire({
|
|
2126
|
+
instance: this,
|
|
2127
|
+
userInitiated: true
|
|
2128
|
+
});
|
|
1905
2129
|
return pickedIcon;
|
|
1906
2130
|
}
|
|
1907
2131
|
async changeColor(color, skipQuickPick) {
|
|
1908
2132
|
if (color) {
|
|
1909
2133
|
this.shellLaunchConfig.color = color;
|
|
1910
|
-
this._onIconChanged.fire({
|
|
2134
|
+
this._onIconChanged.fire({
|
|
2135
|
+
instance: this,
|
|
2136
|
+
userInitiated: true
|
|
2137
|
+
});
|
|
1911
2138
|
return color;
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
this.
|
|
1915
|
-
|
|
2139
|
+
} else if (skipQuickPick) {
|
|
2140
|
+
this.shellLaunchConfig.color = "";
|
|
2141
|
+
this._onIconChanged.fire({
|
|
2142
|
+
instance: this,
|
|
2143
|
+
userInitiated: true
|
|
2144
|
+
});
|
|
1916
2145
|
return;
|
|
1917
2146
|
}
|
|
1918
2147
|
const icon = this._getIcon();
|
|
@@ -1926,18 +2155,27 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1926
2155
|
for (const colorKey of standardColors) {
|
|
1927
2156
|
const colorClass = getColorClass(colorKey);
|
|
1928
2157
|
items.push({
|
|
1929
|
-
label: `$(${Codicon.circleFilled.id}) ${colorKey.replace(
|
|
2158
|
+
label: `$(${Codicon.circleFilled.id}) ${colorKey.replace("terminal.ansi", "")}`,
|
|
2159
|
+
id: colorKey,
|
|
2160
|
+
description: colorKey,
|
|
2161
|
+
iconClasses: [colorClass]
|
|
1930
2162
|
});
|
|
1931
2163
|
}
|
|
1932
|
-
items.push({
|
|
1933
|
-
|
|
2164
|
+
items.push({
|
|
2165
|
+
type: "separator"
|
|
2166
|
+
});
|
|
2167
|
+
const showAllColorsItem = {
|
|
2168
|
+
label: "Reset to default"
|
|
2169
|
+
};
|
|
1934
2170
|
items.push(showAllColorsItem);
|
|
1935
2171
|
const disposables = [];
|
|
1936
|
-
const quickPick = this._quickInputService.createQuickPick({
|
|
2172
|
+
const quickPick = this._quickInputService.createQuickPick({
|
|
2173
|
+
useSeparators: true
|
|
2174
|
+
});
|
|
1937
2175
|
disposables.push(quickPick);
|
|
1938
2176
|
quickPick.items = items;
|
|
1939
2177
|
quickPick.matchOnDescription = true;
|
|
1940
|
-
quickPick.placeholder = ( localize(
|
|
2178
|
+
quickPick.placeholder = ( localize(11926, "Select a color for the terminal"));
|
|
1941
2179
|
quickPick.show();
|
|
1942
2180
|
const result = await ( new Promise(r => {
|
|
1943
2181
|
disposables.push(quickPick.onDidHide(() => r(undefined)));
|
|
@@ -1946,37 +2184,44 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1946
2184
|
dispose(disposables);
|
|
1947
2185
|
if (result) {
|
|
1948
2186
|
this.shellLaunchConfig.color = result.id;
|
|
1949
|
-
this._onIconChanged.fire({
|
|
2187
|
+
this._onIconChanged.fire({
|
|
2188
|
+
instance: this,
|
|
2189
|
+
userInitiated: true
|
|
2190
|
+
});
|
|
1950
2191
|
}
|
|
1951
2192
|
quickPick.hide();
|
|
1952
2193
|
colorStyleDisposable.dispose();
|
|
1953
2194
|
return result?.id;
|
|
1954
2195
|
}
|
|
1955
2196
|
forceScrollbarVisibility() {
|
|
1956
|
-
this._wrapperElement.classList.add(
|
|
2197
|
+
this._wrapperElement.classList.add("force-scrollbar");
|
|
1957
2198
|
}
|
|
1958
2199
|
resetScrollbarVisibility() {
|
|
1959
|
-
this._wrapperElement.classList.remove(
|
|
2200
|
+
this._wrapperElement.classList.remove("force-scrollbar");
|
|
1960
2201
|
}
|
|
1961
2202
|
setParentContextKeyService(parentContextKeyService) {
|
|
1962
2203
|
this._scopedContextKeyService.updateParent(parentContextKeyService);
|
|
1963
2204
|
}
|
|
1964
2205
|
async handleMouseEvent(event, contextMenu) {
|
|
1965
|
-
if (isHTMLElement(event.target) && (event.target.classList.contains(
|
|
1966
|
-
return {
|
|
2206
|
+
if (isHTMLElement(event.target) && (event.target.classList.contains("scrollbar") || event.target.classList.contains("slider"))) {
|
|
2207
|
+
return {
|
|
2208
|
+
cancelContextMenu: true
|
|
2209
|
+
};
|
|
1967
2210
|
}
|
|
1968
2211
|
for (const contrib of ( this._contributions.values())) {
|
|
1969
2212
|
const result = await contrib.handleMouseEvent?.(event);
|
|
1970
2213
|
if (result?.handled) {
|
|
1971
|
-
return {
|
|
2214
|
+
return {
|
|
2215
|
+
cancelContextMenu: true
|
|
2216
|
+
};
|
|
1972
2217
|
}
|
|
1973
2218
|
}
|
|
1974
2219
|
if (event.which === 2) {
|
|
1975
2220
|
switch (this._terminalConfigurationService.config.middleClickBehavior) {
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
2221
|
+
case "default":
|
|
2222
|
+
default:
|
|
2223
|
+
this.focus();
|
|
2224
|
+
break;
|
|
1980
2225
|
}
|
|
1981
2226
|
return;
|
|
1982
2227
|
}
|
|
@@ -1986,60 +2231,39 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1986
2231
|
return;
|
|
1987
2232
|
}
|
|
1988
2233
|
const rightClickBehavior = this._terminalConfigurationService.config.rightClickBehavior;
|
|
1989
|
-
if (rightClickBehavior ===
|
|
2234
|
+
if (rightClickBehavior === "nothing") {
|
|
1990
2235
|
if (!event.shiftKey) {
|
|
1991
|
-
return {
|
|
2236
|
+
return {
|
|
2237
|
+
cancelContextMenu: true
|
|
2238
|
+
};
|
|
1992
2239
|
}
|
|
1993
2240
|
return;
|
|
1994
2241
|
}
|
|
1995
2242
|
}
|
|
1996
2243
|
}
|
|
1997
2244
|
};
|
|
1998
|
-
TerminalInstance.__decorator = ( __decorate(
|
|
1999
|
-
debounce(50)
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
TerminalInstance.__decorator = ( __decorate(
|
|
2005
|
-
debounce(
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
TerminalInstance =
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
( __param(4, IInstantiationService)),
|
|
2014
|
-
( __param(5, ITerminalConfigurationService)),
|
|
2015
|
-
( __param(6, ITerminalProfileResolverService)),
|
|
2016
|
-
( __param(7, IPathService)),
|
|
2017
|
-
( __param(8, IFileService)),
|
|
2018
|
-
( __param(9, IKeybindingService)),
|
|
2019
|
-
( __param(10, INotificationService)),
|
|
2020
|
-
( __param(11, IPreferencesService)),
|
|
2021
|
-
( __param(12, IViewsService)),
|
|
2022
|
-
( __param(13, IThemeService)),
|
|
2023
|
-
( __param(14, IConfigurationService)),
|
|
2024
|
-
( __param(15, ITerminalLogService)),
|
|
2025
|
-
( __param(16, IStorageService)),
|
|
2026
|
-
( __param(17, IAccessibilityService)),
|
|
2027
|
-
( __param(18, IProductService)),
|
|
2028
|
-
( __param(19, IQuickInputService)),
|
|
2029
|
-
( __param(20, IWorkbenchEnvironmentService)),
|
|
2030
|
-
( __param(21, IWorkspaceContextService)),
|
|
2031
|
-
( __param(22, IEditorService)),
|
|
2032
|
-
( __param(23, IWorkspaceTrustRequestService)),
|
|
2033
|
-
( __param(24, IHistoryService)),
|
|
2034
|
-
( __param(25, ITelemetryService)),
|
|
2035
|
-
( __param(26, IOpenerService)),
|
|
2036
|
-
( __param(27, ICommandService)),
|
|
2037
|
-
( __param(28, IAccessibilitySignalService)),
|
|
2038
|
-
( __param(29, IViewDescriptorService))
|
|
2039
|
-
], TerminalInstance));
|
|
2245
|
+
TerminalInstance.__decorator = ( __decorate(
|
|
2246
|
+
[debounce(50)],
|
|
2247
|
+
TerminalInstance.prototype,
|
|
2248
|
+
"_fireMaximumDimensionsChanged",
|
|
2249
|
+
null
|
|
2250
|
+
));
|
|
2251
|
+
TerminalInstance.__decorator = ( __decorate(
|
|
2252
|
+
[debounce(500)],
|
|
2253
|
+
TerminalInstance.prototype,
|
|
2254
|
+
"_refreshShellIntegrationInfoStatus",
|
|
2255
|
+
null
|
|
2256
|
+
));
|
|
2257
|
+
TerminalInstance.__decorator = ( __decorate([debounce(1000)], TerminalInstance.prototype, "relaunch", null));
|
|
2258
|
+
TerminalInstance.__decorator = ( __decorate([debounce(2000)], TerminalInstance.prototype, "_updateProcessCwd", null));
|
|
2259
|
+
TerminalInstance = TerminalInstance_1 = ( __decorate([( __param(2, IContextKeyService)), ( __param(3, IContextMenuService)), ( __param(4, IInstantiationService)), ( __param(5, ITerminalConfigurationService)), ( __param(6, ITerminalProfileResolverService)), ( __param(7, IPathService)), ( __param(8, IFileService)), ( __param(9, IKeybindingService)), ( __param(10, INotificationService)), ( __param(11, IPreferencesService)), ( __param(12, IViewsService)), ( __param(13, IThemeService)), ( __param(14, IConfigurationService)), ( __param(15, ITerminalLogService)), ( __param(16, IStorageService)), ( __param(17, IAccessibilityService)), ( __param(18, IProductService)), ( __param(19, IQuickInputService)), ( __param(20, IWorkbenchEnvironmentService)), ( __param(21, IWorkspaceContextService)), ( __param(22, IEditorService)), ( __param(23, IWorkspaceTrustRequestService)), ( __param(24, IHistoryService)), ( __param(25, ITelemetryService)), ( __param(26, IOpenerService)), ( __param(27, ICommandService)), ( __param(28, IAccessibilitySignalService)), ( __param(29, IViewDescriptorService))], TerminalInstance));
|
|
2040
2260
|
let TerminalInstanceDragAndDropController = class TerminalInstanceDragAndDropController extends Disposable {
|
|
2041
|
-
get onDropFile() {
|
|
2042
|
-
|
|
2261
|
+
get onDropFile() {
|
|
2262
|
+
return this._onDropFile.event;
|
|
2263
|
+
}
|
|
2264
|
+
get onDropTerminal() {
|
|
2265
|
+
return this._onDropTerminal.event;
|
|
2266
|
+
}
|
|
2043
2267
|
constructor(_container, _layoutService, _viewDescriptorService) {
|
|
2044
2268
|
super();
|
|
2045
2269
|
this._container = _container;
|
|
@@ -2054,17 +2278,23 @@ let TerminalInstanceDragAndDropController = class TerminalInstanceDragAndDropCon
|
|
|
2054
2278
|
this._dropOverlay = undefined;
|
|
2055
2279
|
}
|
|
2056
2280
|
onDragEnter(e) {
|
|
2057
|
-
if (!containsDragType(
|
|
2281
|
+
if (!containsDragType(
|
|
2282
|
+
e,
|
|
2283
|
+
DataTransfers.FILES,
|
|
2284
|
+
DataTransfers.RESOURCES,
|
|
2285
|
+
TerminalDataTransfers.Terminals,
|
|
2286
|
+
CodeDataTransfers.FILES
|
|
2287
|
+
)) {
|
|
2058
2288
|
return;
|
|
2059
2289
|
}
|
|
2060
2290
|
if (!this._dropOverlay) {
|
|
2061
|
-
this._dropOverlay = createElement(
|
|
2062
|
-
this._dropOverlay.classList.add(
|
|
2291
|
+
this._dropOverlay = createElement("div");
|
|
2292
|
+
this._dropOverlay.classList.add("terminal-drop-overlay");
|
|
2063
2293
|
}
|
|
2064
2294
|
if (containsDragType(e, TerminalDataTransfers.Terminals)) {
|
|
2065
2295
|
const side = this._getDropSide(e);
|
|
2066
|
-
this._dropOverlay.classList.toggle(
|
|
2067
|
-
this._dropOverlay.classList.toggle(
|
|
2296
|
+
this._dropOverlay.classList.toggle("drop-before", side === "before");
|
|
2297
|
+
this._dropOverlay.classList.toggle("drop-after", side === "after");
|
|
2068
2298
|
}
|
|
2069
2299
|
if (!this._dropOverlay.parentElement) {
|
|
2070
2300
|
this._container.appendChild(this._dropOverlay);
|
|
@@ -2082,10 +2312,10 @@ let TerminalInstanceDragAndDropController = class TerminalInstanceDragAndDropCon
|
|
|
2082
2312
|
}
|
|
2083
2313
|
if (containsDragType(e, TerminalDataTransfers.Terminals)) {
|
|
2084
2314
|
const side = this._getDropSide(e);
|
|
2085
|
-
this._dropOverlay.classList.toggle(
|
|
2086
|
-
this._dropOverlay.classList.toggle(
|
|
2315
|
+
this._dropOverlay.classList.toggle("drop-before", side === "before");
|
|
2316
|
+
this._dropOverlay.classList.toggle("drop-after", side === "after");
|
|
2087
2317
|
}
|
|
2088
|
-
this._dropOverlay.style.opacity =
|
|
2318
|
+
this._dropOverlay.style.opacity = "1";
|
|
2089
2319
|
}
|
|
2090
2320
|
async onDrop(e) {
|
|
2091
2321
|
this._clearDropOverlay();
|
|
@@ -2096,7 +2326,10 @@ let TerminalInstanceDragAndDropController = class TerminalInstanceDragAndDropCon
|
|
|
2096
2326
|
if (terminalResources) {
|
|
2097
2327
|
for (const uri of terminalResources) {
|
|
2098
2328
|
const side = this._getDropSide(e);
|
|
2099
|
-
this._onDropTerminal.fire({
|
|
2329
|
+
this._onDropTerminal.fire({
|
|
2330
|
+
uri,
|
|
2331
|
+
side
|
|
2332
|
+
});
|
|
2100
2333
|
}
|
|
2101
2334
|
return;
|
|
2102
2335
|
}
|
|
@@ -2120,84 +2353,89 @@ let TerminalInstanceDragAndDropController = class TerminalInstanceDragAndDropCon
|
|
|
2120
2353
|
_getDropSide(e) {
|
|
2121
2354
|
const target = this._container;
|
|
2122
2355
|
if (!target) {
|
|
2123
|
-
return
|
|
2356
|
+
return "after";
|
|
2124
2357
|
}
|
|
2125
2358
|
const rect = target.getBoundingClientRect();
|
|
2126
|
-
return this._getViewOrientation() === Orientation.HORIZONTAL
|
|
2127
|
-
? (e.clientX - rect.left < rect.width / 2 ? 'before' : 'after')
|
|
2128
|
-
: (e.clientY - rect.top < rect.height / 2 ? 'before' : 'after');
|
|
2359
|
+
return this._getViewOrientation() === Orientation.HORIZONTAL ? (e.clientX - rect.left < rect.width / 2 ? "before" : "after") : (e.clientY - rect.top < rect.height / 2 ? "before" : "after");
|
|
2129
2360
|
}
|
|
2130
2361
|
_getViewOrientation() {
|
|
2131
2362
|
const panelPosition = this._layoutService.getPanelPosition();
|
|
2132
2363
|
const terminalLocation = this._viewDescriptorService.getViewLocationById(TERMINAL_VIEW_ID);
|
|
2133
|
-
return terminalLocation === ViewContainerLocation.Panel && isHorizontal(panelPosition)
|
|
2134
|
-
? Orientation.HORIZONTAL
|
|
2135
|
-
: Orientation.VERTICAL;
|
|
2364
|
+
return terminalLocation === ViewContainerLocation.Panel && isHorizontal(panelPosition) ? Orientation.HORIZONTAL : Orientation.VERTICAL;
|
|
2136
2365
|
}
|
|
2137
2366
|
};
|
|
2138
|
-
TerminalInstanceDragAndDropController = ( __decorate([
|
|
2139
|
-
( __param(1, IWorkbenchLayoutService)),
|
|
2140
|
-
( __param(2, IViewDescriptorService))
|
|
2141
|
-
], TerminalInstanceDragAndDropController));
|
|
2367
|
+
TerminalInstanceDragAndDropController = ( __decorate([( __param(1, IWorkbenchLayoutService)), ( __param(2, IViewDescriptorService))], TerminalInstanceDragAndDropController));
|
|
2142
2368
|
var TerminalLabelType;
|
|
2143
|
-
(function
|
|
2369
|
+
(function(TerminalLabelType) {
|
|
2144
2370
|
TerminalLabelType["Title"] = "title";
|
|
2145
2371
|
TerminalLabelType["Description"] = "description";
|
|
2146
2372
|
})(TerminalLabelType || (TerminalLabelType = {}));
|
|
2147
2373
|
let TerminalLabelComputer = class TerminalLabelComputer extends Disposable {
|
|
2148
|
-
get title() {
|
|
2149
|
-
|
|
2374
|
+
get title() {
|
|
2375
|
+
return this._title;
|
|
2376
|
+
}
|
|
2377
|
+
get description() {
|
|
2378
|
+
return this._description;
|
|
2379
|
+
}
|
|
2150
2380
|
constructor(_fileService, _terminalConfigurationService, _workspaceContextService) {
|
|
2151
2381
|
super();
|
|
2152
2382
|
this._fileService = _fileService;
|
|
2153
2383
|
this._terminalConfigurationService = _terminalConfigurationService;
|
|
2154
2384
|
this._workspaceContextService = _workspaceContextService;
|
|
2155
|
-
this._title =
|
|
2156
|
-
this._description =
|
|
2385
|
+
this._title = "";
|
|
2386
|
+
this._description = "";
|
|
2157
2387
|
this._onDidChangeLabel = this._register(( new Emitter()));
|
|
2158
2388
|
this.onDidChangeLabel = this._onDidChangeLabel.event;
|
|
2159
2389
|
}
|
|
2160
2390
|
refreshLabel(instance, reset) {
|
|
2161
|
-
this._title = this.computeLabel(
|
|
2162
|
-
|
|
2391
|
+
this._title = this.computeLabel(
|
|
2392
|
+
instance,
|
|
2393
|
+
this._terminalConfigurationService.config.tabs.title,
|
|
2394
|
+
TerminalLabelType.Title,
|
|
2395
|
+
reset
|
|
2396
|
+
);
|
|
2397
|
+
this._description = this.computeLabel(
|
|
2398
|
+
instance,
|
|
2399
|
+
this._terminalConfigurationService.config.tabs.description,
|
|
2400
|
+
TerminalLabelType.Description
|
|
2401
|
+
);
|
|
2163
2402
|
if (this._title !== instance.title || this._description !== instance.description || reset) {
|
|
2164
|
-
this._onDidChangeLabel.fire({
|
|
2403
|
+
this._onDidChangeLabel.fire({
|
|
2404
|
+
title: this._title,
|
|
2405
|
+
description: this._description
|
|
2406
|
+
});
|
|
2165
2407
|
}
|
|
2166
2408
|
}
|
|
2167
2409
|
computeLabel(instance, labelTemplate, labelType, reset) {
|
|
2168
2410
|
const type = instance.shellLaunchConfig.attachPersistentProcess?.type || instance.shellLaunchConfig.type;
|
|
2169
2411
|
const commandDetection = instance.capabilities.get(TerminalCapability.CommandDetection);
|
|
2170
2412
|
const promptInputModel = commandDetection?.promptInputModel;
|
|
2171
|
-
const nonTaskSpinner = type ===
|
|
2413
|
+
const nonTaskSpinner = type === "Task" ? "" : " $(loading~spin)";
|
|
2172
2414
|
const templateProperties = {
|
|
2173
|
-
cwd: instance.cwd || instance.initialCwd ||
|
|
2174
|
-
cwdFolder:
|
|
2415
|
+
cwd: instance.cwd || instance.initialCwd || "",
|
|
2416
|
+
cwdFolder: "",
|
|
2175
2417
|
workspaceFolderName: instance.workspaceFolder?.name,
|
|
2176
2418
|
workspaceFolder: instance.workspaceFolder ? basename(instance.workspaceFolder.uri.fsPath) : undefined,
|
|
2177
|
-
local: type ===
|
|
2419
|
+
local: type === "Local" ? terminalStrings.typeLocal : undefined,
|
|
2178
2420
|
process: instance.processName,
|
|
2179
2421
|
sequence: instance.sequence,
|
|
2180
|
-
task: type ===
|
|
2181
|
-
fixedDimensions: instance.fixedCols
|
|
2182
|
-
|
|
2183
|
-
:
|
|
2184
|
-
|
|
2422
|
+
task: type === "Task" ? terminalStrings.typeTask : undefined,
|
|
2423
|
+
fixedDimensions: instance.fixedCols ? (instance.fixedRows ? `\u2194${instance.fixedCols} \u2195${instance.fixedRows}` : `\u2194${instance.fixedCols}`) : (instance.fixedRows ? `\u2195${instance.fixedRows}` : ""),
|
|
2424
|
+
separator: {
|
|
2425
|
+
label: this._terminalConfigurationService.config.tabs.separator
|
|
2426
|
+
},
|
|
2185
2427
|
shellType: instance.shellType,
|
|
2186
|
-
shellCommand: commandDetection?.executingCommand && commandDetection.executingCommandConfidence ===
|
|
2187
|
-
|
|
2188
|
-
: undefined,
|
|
2189
|
-
shellPromptInput: commandDetection?.executingCommand && promptInputModel
|
|
2190
|
-
? promptInputModel.getCombinedString(true) + nonTaskSpinner
|
|
2191
|
-
: promptInputModel?.getCombinedString(true),
|
|
2428
|
+
shellCommand: commandDetection?.executingCommand && commandDetection.executingCommandConfidence === "high" && promptInputModel ? promptInputModel.value + nonTaskSpinner : undefined,
|
|
2429
|
+
shellPromptInput: commandDetection?.executingCommand && promptInputModel ? promptInputModel.getCombinedString(true) + nonTaskSpinner : promptInputModel?.getCombinedString(true),
|
|
2192
2430
|
progress: this._getProgressStateString(instance.progressState)
|
|
2193
2431
|
};
|
|
2194
2432
|
templateProperties.workspaceFolderName = instance.workspaceFolder?.name ?? templateProperties.workspaceFolder;
|
|
2195
2433
|
labelTemplate = labelTemplate.trim();
|
|
2196
2434
|
if (!labelTemplate) {
|
|
2197
|
-
return labelType === TerminalLabelType.Title ? (instance.processName ||
|
|
2435
|
+
return labelType === TerminalLabelType.Title ? (instance.processName || "") : "";
|
|
2198
2436
|
}
|
|
2199
2437
|
if (!reset && instance.staticTitle && labelType === TerminalLabelType.Title) {
|
|
2200
|
-
return instance.staticTitle.replace(/[\n\r\t]/g,
|
|
2438
|
+
return instance.staticTitle.replace(/[\n\r\t]/g, "") || templateProperties.process?.replace(/[\n\r\t]/g, "") || "";
|
|
2201
2439
|
}
|
|
2202
2440
|
const detection = ( instance.capabilities.has(TerminalCapability.CwdDetection)) || ( instance.capabilities.has(TerminalCapability.NaiveCwdDetection));
|
|
2203
2441
|
const folders = this._workspaceContextService.getWorkspace().folders;
|
|
@@ -2210,84 +2448,90 @@ let TerminalLabelComputer = class TerminalLabelComputer extends Disposable {
|
|
|
2210
2448
|
let showCwd = false;
|
|
2211
2449
|
if (multiRootWorkspace) {
|
|
2212
2450
|
showCwd = true;
|
|
2213
|
-
}
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2451
|
+
} else if (instance.workspaceFolder?.uri) {
|
|
2452
|
+
const caseSensitive = this._fileService.hasCapability(
|
|
2453
|
+
instance.workspaceFolder.uri,
|
|
2454
|
+
FileSystemProviderCapabilities.PathCaseSensitive
|
|
2455
|
+
);
|
|
2456
|
+
showCwd = cwdUri.fsPath.localeCompare(instance.workspaceFolder.uri.fsPath, undefined, {
|
|
2457
|
+
sensitivity: caseSensitive ? "case" : "base"
|
|
2458
|
+
}) !== 0;
|
|
2217
2459
|
}
|
|
2218
2460
|
if (showCwd) {
|
|
2219
2461
|
templateProperties.cwdFolder = basename(templateProperties.cwd);
|
|
2220
2462
|
}
|
|
2221
2463
|
}
|
|
2222
|
-
const label = template(labelTemplate, templateProperties).replace(/[\n\r\t]/g,
|
|
2223
|
-
return label ===
|
|
2464
|
+
const label = template(labelTemplate, templateProperties).replace(/[\n\r\t]/g, "").trim();
|
|
2465
|
+
return label === "" && labelType === TerminalLabelType.Title ? (instance.processName || "") : label;
|
|
2224
2466
|
}
|
|
2225
2467
|
_getProgressStateString(progressState) {
|
|
2226
2468
|
if (!progressState) {
|
|
2227
|
-
return
|
|
2469
|
+
return "";
|
|
2228
2470
|
}
|
|
2229
2471
|
switch (progressState.state) {
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2472
|
+
case 0:
|
|
2473
|
+
return "";
|
|
2474
|
+
case 1:
|
|
2475
|
+
return `${Math.round(progressState.value)}%`;
|
|
2476
|
+
case 2:
|
|
2477
|
+
return "$(error)";
|
|
2478
|
+
case 3:
|
|
2479
|
+
return "$(loading~spin)";
|
|
2480
|
+
case 4:
|
|
2481
|
+
return "$(alert)";
|
|
2235
2482
|
}
|
|
2236
2483
|
}
|
|
2237
2484
|
};
|
|
2238
|
-
TerminalLabelComputer = ( __decorate([
|
|
2239
|
-
( __param(0, IFileService)),
|
|
2240
|
-
( __param(1, ITerminalConfigurationService)),
|
|
2241
|
-
( __param(2, IWorkspaceContextService))
|
|
2242
|
-
], TerminalLabelComputer));
|
|
2485
|
+
TerminalLabelComputer = ( __decorate([( __param(0, IFileService)), ( __param(1, ITerminalConfigurationService)), ( __param(2, IWorkspaceContextService))], TerminalLabelComputer));
|
|
2243
2486
|
function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initialCwd) {
|
|
2244
2487
|
if (exitCodeOrError === undefined || exitCodeOrError === 0) {
|
|
2245
|
-
return {
|
|
2488
|
+
return {
|
|
2489
|
+
code: exitCodeOrError,
|
|
2490
|
+
message: undefined
|
|
2491
|
+
};
|
|
2246
2492
|
}
|
|
2247
2493
|
const code = isNumber(exitCodeOrError) ? exitCodeOrError : exitCodeOrError.code;
|
|
2248
2494
|
let message = undefined;
|
|
2249
2495
|
switch (typeof exitCodeOrError) {
|
|
2250
|
-
|
|
2496
|
+
case "number":
|
|
2497
|
+
{
|
|
2251
2498
|
let commandLine = undefined;
|
|
2252
2499
|
if (shellLaunchConfig.executable) {
|
|
2253
2500
|
commandLine = shellLaunchConfig.executable;
|
|
2254
2501
|
if (isString(shellLaunchConfig.args)) {
|
|
2255
2502
|
commandLine += ` ${shellLaunchConfig.args}`;
|
|
2256
|
-
}
|
|
2257
|
-
else if (shellLaunchConfig.args && shellLaunchConfig.args.length) {
|
|
2503
|
+
} else if (shellLaunchConfig.args && shellLaunchConfig.args.length) {
|
|
2258
2504
|
commandLine += ( shellLaunchConfig.args.map(a => ` '${a}'`)).join();
|
|
2259
2505
|
}
|
|
2260
2506
|
}
|
|
2261
2507
|
if (processState === ProcessState.KilledDuringLaunch) {
|
|
2262
2508
|
if (commandLine) {
|
|
2263
2509
|
message = ( localize(
|
|
2264
|
-
|
|
2510
|
+
11927,
|
|
2265
2511
|
"The terminal process \"{0}\" failed to launch (exit code: {1}).",
|
|
2266
2512
|
commandLine,
|
|
2267
2513
|
code
|
|
2268
2514
|
));
|
|
2515
|
+
} else {
|
|
2516
|
+
message = ( localize(11928, "The terminal process failed to launch (exit code: {0}).", code));
|
|
2269
2517
|
}
|
|
2270
|
-
|
|
2271
|
-
message = ( localize(11604, "The terminal process failed to launch (exit code: {0}).", code));
|
|
2272
|
-
}
|
|
2273
|
-
}
|
|
2274
|
-
else {
|
|
2518
|
+
} else {
|
|
2275
2519
|
if (commandLine) {
|
|
2276
2520
|
message = ( localize(
|
|
2277
|
-
|
|
2521
|
+
11929,
|
|
2278
2522
|
"The terminal process \"{0}\" terminated with exit code: {1}.",
|
|
2279
2523
|
commandLine,
|
|
2280
2524
|
code
|
|
2281
2525
|
));
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
message = ( localize(11606, "The terminal process terminated with exit code: {0}.", code));
|
|
2526
|
+
} else {
|
|
2527
|
+
message = ( localize(11930, "The terminal process terminated with exit code: {0}.", code));
|
|
2285
2528
|
}
|
|
2286
2529
|
}
|
|
2287
2530
|
break;
|
|
2288
2531
|
}
|
|
2289
|
-
|
|
2290
|
-
|
|
2532
|
+
case "object":
|
|
2533
|
+
{
|
|
2534
|
+
if (( exitCodeOrError.message.toString()).includes("Could not find pty with id")) {
|
|
2291
2535
|
break;
|
|
2292
2536
|
}
|
|
2293
2537
|
let innerMessage = exitCodeOrError.message;
|
|
@@ -2295,22 +2539,25 @@ function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initi
|
|
|
2295
2539
|
if (conptyError) {
|
|
2296
2540
|
const errorCode = conptyError.length > 1 ? parseInt(conptyError[1]) : undefined;
|
|
2297
2541
|
switch (errorCode) {
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2542
|
+
case 5:
|
|
2543
|
+
innerMessage = `Access was denied to the path containing your executable "${shellLaunchConfig.executable}". Manage and change your permissions to get this to work`;
|
|
2544
|
+
break;
|
|
2545
|
+
case 267:
|
|
2546
|
+
innerMessage = `Invalid starting directory "${initialCwd}", review your terminal.integrated.cwd setting`;
|
|
2547
|
+
break;
|
|
2548
|
+
case 1260:
|
|
2549
|
+
innerMessage = `Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open Event Viewer or contact your system Administrator`;
|
|
2550
|
+
break;
|
|
2307
2551
|
}
|
|
2308
2552
|
}
|
|
2309
|
-
message = ( localize(
|
|
2553
|
+
message = ( localize(11931, "The terminal process failed to launch: {0}.", innerMessage));
|
|
2310
2554
|
break;
|
|
2311
2555
|
}
|
|
2312
2556
|
}
|
|
2313
|
-
return {
|
|
2557
|
+
return {
|
|
2558
|
+
code,
|
|
2559
|
+
message
|
|
2560
|
+
};
|
|
2314
2561
|
}
|
|
2315
2562
|
let TerminalInstanceColorProvider = class TerminalInstanceColorProvider {
|
|
2316
2563
|
constructor(_target, _viewDescriptorService) {
|
|
@@ -2332,9 +2579,7 @@ let TerminalInstanceColorProvider = class TerminalInstanceColorProvider {
|
|
|
2332
2579
|
return theme.getColor(SIDE_BAR_BACKGROUND);
|
|
2333
2580
|
}
|
|
2334
2581
|
};
|
|
2335
|
-
TerminalInstanceColorProvider = ( __decorate([
|
|
2336
|
-
( __param(1, IViewDescriptorService))
|
|
2337
|
-
], TerminalInstanceColorProvider));
|
|
2582
|
+
TerminalInstanceColorProvider = ( __decorate([( __param(1, IViewDescriptorService))], TerminalInstanceColorProvider));
|
|
2338
2583
|
function guessShellTypeFromExecutable(os, executable) {
|
|
2339
2584
|
const exeBasename = basename(executable);
|
|
2340
2585
|
const generalShellTypeMap = ( new Map([
|
|
@@ -2361,15 +2606,14 @@ function guessShellTypeFromExecutable(os, executable) {
|
|
|
2361
2606
|
return shellType;
|
|
2362
2607
|
}
|
|
2363
2608
|
}
|
|
2364
|
-
}
|
|
2365
|
-
else {
|
|
2609
|
+
} else {
|
|
2366
2610
|
const posixShellTypes = [
|
|
2367
2611
|
PosixShellType.Bash,
|
|
2368
2612
|
PosixShellType.Csh,
|
|
2369
2613
|
PosixShellType.Fish,
|
|
2370
2614
|
PosixShellType.Ksh,
|
|
2371
2615
|
PosixShellType.Sh,
|
|
2372
|
-
PosixShellType.Zsh
|
|
2616
|
+
PosixShellType.Zsh
|
|
2373
2617
|
];
|
|
2374
2618
|
for (const type of posixShellTypes) {
|
|
2375
2619
|
if (exeBasename === type) {
|