@codingame/monaco-vscode-xterm-common 24.3.0 → 25.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/workbench/contrib/terminal/browser/environmentVariableInfo.js +5 -5
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalActions.js +75 -71
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIconPicker.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalInstance.js +80 -35
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTabsList.js +39 -37
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.d.ts +2 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalTooltip.js +6 -50
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChat.js +9 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/stickyScroll/browser/terminalStickyScrollColorRegistry.js +3 -3
- 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 +12 -10
|
@@ -100,7 +100,6 @@ import { TerminalResizeDebouncer } from './terminalResizeDebouncer.js';
|
|
|
100
100
|
import { openContextMenu } from './terminalContextMenu.js';
|
|
101
101
|
import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
|
|
102
102
|
import { TerminalContribCommandId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/terminalContribExports';
|
|
103
|
-
import { refreshShellIntegrationInfoStatus } from './terminalTooltip.js';
|
|
104
103
|
import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
|
|
105
104
|
import { PromptInputState } from '@codingame/monaco-vscode-api/vscode/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel';
|
|
106
105
|
import { isString, hasKey, isNumber } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
|
|
@@ -373,7 +372,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
373
372
|
capabilityListeners.get(e.id)?.dispose();
|
|
374
373
|
const refreshInfo = () => {
|
|
375
374
|
this._labelComputer?.refreshLabel(this);
|
|
376
|
-
|
|
375
|
+
this._refreshShellIntegrationInfoStatus(this);
|
|
377
376
|
};
|
|
378
377
|
switch (e.id) {
|
|
379
378
|
case TerminalCapability.CwdDetection: {
|
|
@@ -401,7 +400,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
401
400
|
}
|
|
402
401
|
}
|
|
403
402
|
}));
|
|
404
|
-
this._register(this.onDidChangeShellType(() =>
|
|
403
|
+
this._register(this.onDidChangeShellType(() => this._refreshShellIntegrationInfoStatus(this)));
|
|
405
404
|
this._register(this.capabilities.onDidRemoveCapability(e => {
|
|
406
405
|
capabilityListeners.get(e.id)?.dispose();
|
|
407
406
|
}));
|
|
@@ -613,13 +612,13 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
613
612
|
}
|
|
614
613
|
xtermConstructor = Promises.withAsyncBody(async (resolve) => {
|
|
615
614
|
const Terminal = (await import('@xterm/xterm').then(module => module.default ?? module)).Terminal;
|
|
616
|
-
Terminal.strings.promptLabel = ( localize(
|
|
615
|
+
Terminal.strings.promptLabel = ( localize(11577, 'Terminal input'));
|
|
617
616
|
Terminal.strings.tooMuchOutput = keybinding ? ( localize(
|
|
618
|
-
|
|
617
|
+
11578,
|
|
619
618
|
'Use the accessible buffer {0} to manually review output',
|
|
620
619
|
keybinding.getLabel()
|
|
621
620
|
)) : ( localize(
|
|
622
|
-
|
|
621
|
+
11579,
|
|
623
622
|
'Use the Terminal: Focus Accessible Buffer command to manually review output'
|
|
624
623
|
));
|
|
625
624
|
resolve(Terminal);
|
|
@@ -672,7 +671,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
672
671
|
id: TerminalStatus.Bell,
|
|
673
672
|
severity: Severity.Warning,
|
|
674
673
|
icon: Codicon.bell,
|
|
675
|
-
tooltip: ( localize(
|
|
674
|
+
tooltip: ( localize(11580, "Bell"))
|
|
676
675
|
}, this._terminalConfigurationService.config.bellDuration);
|
|
677
676
|
}
|
|
678
677
|
this._accessibilitySignalService.playSignal(AccessibilitySignal.terminalBell);
|
|
@@ -709,7 +708,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
709
708
|
this._register(xterm.onDidChangeProgress(() => this._labelComputer?.refreshLabel(this)));
|
|
710
709
|
this._register(Event.runAndSubscribe(xterm.shellIntegration.onDidChangeSeenSequences, () => {
|
|
711
710
|
if (xterm.shellIntegration.seenSequences.size > 0) {
|
|
712
|
-
|
|
711
|
+
this._refreshShellIntegrationInfoStatus(this);
|
|
713
712
|
}
|
|
714
713
|
}));
|
|
715
714
|
if (!( this.capabilities.has(TerminalCapability.CwdDetection))) {
|
|
@@ -735,6 +734,47 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
735
734
|
}
|
|
736
735
|
return xterm;
|
|
737
736
|
}
|
|
737
|
+
_refreshShellIntegrationInfoStatus(instance) {
|
|
738
|
+
if (!instance.xterm) {
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
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')));
|
|
748
|
+
const detailedAdditions = [];
|
|
749
|
+
if (instance.shellType) {
|
|
750
|
+
detailedAdditions.push(`Shell type: \`${instance.shellType}\``);
|
|
751
|
+
}
|
|
752
|
+
const cwd = instance.cwd;
|
|
753
|
+
if (cwd) {
|
|
754
|
+
detailedAdditions.push(`Current working directory: \`${cwd}\``);
|
|
755
|
+
}
|
|
756
|
+
const seenSequences = Array.from(instance.xterm.shellIntegration.seenSequences);
|
|
757
|
+
if (seenSequences.length > 0) {
|
|
758
|
+
detailedAdditions.push(`Seen sequences: ${( seenSequences.map(e => `\`${e}\``)).join(', ')}`);
|
|
759
|
+
}
|
|
760
|
+
const promptType = instance.capabilities.get(TerminalCapability.PromptTypeDetection)?.promptType;
|
|
761
|
+
if (promptType) {
|
|
762
|
+
detailedAdditions.push(`Prompt type: \`${promptType}\``);
|
|
763
|
+
}
|
|
764
|
+
const combinedString = instance.capabilities.get(TerminalCapability.CommandDetection)?.promptInputModel.getCombinedString();
|
|
765
|
+
if (combinedString !== undefined) {
|
|
766
|
+
detailedAdditions.push(`Prompt input: \`\`\`${combinedString}\`\`\``);
|
|
767
|
+
}
|
|
768
|
+
const detailedAdditionsString = detailedAdditions.length > 0
|
|
769
|
+
? '\n\n' + ( detailedAdditions.map(e => `- ${e}`)).join('\n')
|
|
770
|
+
: '';
|
|
771
|
+
instance.statusList.add({
|
|
772
|
+
id: TerminalStatus.ShellIntegrationInfo,
|
|
773
|
+
severity: Severity.Info,
|
|
774
|
+
tooltip: `${( localize(11585, "Shell integration"))}: ${cmdDetectionType}`,
|
|
775
|
+
detailedTooltip: `${( localize(11585, "Shell integration"))}: ${cmdDetectionType}${detailedAdditionsString}`
|
|
776
|
+
});
|
|
777
|
+
}
|
|
738
778
|
async runCommand(commandLine, shouldExecute, commandId) {
|
|
739
779
|
let commandDetection = this.capabilities.get(TerminalCapability.CommandDetection);
|
|
740
780
|
const siInjectionEnabled = this._configurationService.getValue(TerminalSettingId.ShellIntegrationEnabled) === true;
|
|
@@ -763,7 +803,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
763
803
|
this.xterm?.shellIntegration.setNextCommandId(commandLine, commandId);
|
|
764
804
|
await this._processManager.setNextCommandId(commandLine, commandId);
|
|
765
805
|
}
|
|
766
|
-
if (!commandDetection || commandDetection.promptInputModel.value.length > 0) {
|
|
806
|
+
if (shouldExecute && (!commandDetection || commandDetection.promptInputModel.value.length > 0)) {
|
|
767
807
|
await this.sendText('\x03', false);
|
|
768
808
|
await timeout(100);
|
|
769
809
|
}
|
|
@@ -802,12 +842,13 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
802
842
|
'A container element needs to be set with `attachToElement` and be part of the DOM before calling `_open`'
|
|
803
843
|
));
|
|
804
844
|
}
|
|
805
|
-
const
|
|
806
|
-
|
|
845
|
+
const xtermHost = createElement('div');
|
|
846
|
+
xtermHost.classList.add('terminal-xterm-host');
|
|
847
|
+
this._wrapperElement.appendChild(xtermHost);
|
|
807
848
|
this._container.appendChild(this._wrapperElement);
|
|
808
849
|
const xterm = this.xterm;
|
|
809
850
|
this._wrapperElement.xterm = xterm.raw;
|
|
810
|
-
const screenElement = xterm.attachToElement(
|
|
851
|
+
const screenElement = xterm.attachToElement(xtermHost);
|
|
811
852
|
for (const contribution of ( this._contributions.values())) {
|
|
812
853
|
if (!this.xterm) {
|
|
813
854
|
this._xtermReadyPromise.then(xterm => {
|
|
@@ -857,12 +898,12 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
857
898
|
this._hasHadInput &&
|
|
858
899
|
!TERMINAL_CREATION_COMMANDS.includes(resolveResult.commandId)) {
|
|
859
900
|
this._notificationService.prompt(Severity.Info, ( localize(
|
|
860
|
-
|
|
901
|
+
11586,
|
|
861
902
|
"Some keybindings don't go to the terminal by default and are handled by {0} instead.",
|
|
862
903
|
this._productService.nameLong
|
|
863
904
|
)), [
|
|
864
905
|
{
|
|
865
|
-
label: ( localize(
|
|
906
|
+
label: ( localize(11587, "Configure Terminal Settings")),
|
|
866
907
|
run: () => {
|
|
867
908
|
this._preferencesService.openSettings({ jsonEditor: false, query: `@id:${TerminalSettingId.CommandsToSkipShell},${TerminalSettingId.SendKeybindingsToShell},${TerminalSettingId.AllowChords}` });
|
|
868
909
|
}
|
|
@@ -1180,7 +1221,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1180
1221
|
id: TerminalStatus.Disconnected,
|
|
1181
1222
|
severity: Severity.Error,
|
|
1182
1223
|
icon: Codicon.debugDisconnect,
|
|
1183
|
-
tooltip: ( localize(
|
|
1224
|
+
tooltip: ( localize(11588, "Lost connection to process"))
|
|
1184
1225
|
});
|
|
1185
1226
|
}));
|
|
1186
1227
|
this._register(processManager.onPtyReconnect(() => {
|
|
@@ -1197,12 +1238,12 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1197
1238
|
}
|
|
1198
1239
|
const trusted = await this._trust();
|
|
1199
1240
|
if (!trusted && !this.remoteAuthority && !this._workbenchEnvironmentService.remoteAuthority) {
|
|
1200
|
-
this._onProcessExit({ message: ( localize(
|
|
1241
|
+
this._onProcessExit({ message: ( localize(11589, "Cannot launch a terminal process in an untrusted workspace")) });
|
|
1201
1242
|
}
|
|
1202
1243
|
else if (this._workspaceContextService.getWorkspace().folders.length === 0 && this._cwd && this._userHome && this._cwd !== this._userHome) {
|
|
1203
1244
|
this._onProcessExit({
|
|
1204
1245
|
message: ( localize(
|
|
1205
|
-
|
|
1246
|
+
11590,
|
|
1206
1247
|
"Cannot launch a terminal process in an untrusted workspace with cwd {0} and userHome {1}",
|
|
1207
1248
|
this._cwd,
|
|
1208
1249
|
this._userHome
|
|
@@ -1346,16 +1387,16 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1346
1387
|
id: TerminalStatus.ShellIntegrationAttentionNeeded,
|
|
1347
1388
|
severity: Severity.Warning,
|
|
1348
1389
|
icon: Codicon.warning,
|
|
1349
|
-
tooltip: `${exitMessage} ` + ( localize(
|
|
1390
|
+
tooltip: `${exitMessage} ` + ( localize(11591, 'Disabling shell integration in user settings might help.')),
|
|
1350
1391
|
hoverActions: [{
|
|
1351
1392
|
commandId: TerminalCommandId.ShellIntegrationLearnMore,
|
|
1352
|
-
label: ( localize(
|
|
1393
|
+
label: ( localize(11592, "Learn more about shell integration")),
|
|
1353
1394
|
run: () => {
|
|
1354
1395
|
this._openerService.open('https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration');
|
|
1355
1396
|
}
|
|
1356
1397
|
}, {
|
|
1357
1398
|
commandId: 'workbench.action.openSettings',
|
|
1358
|
-
label: ( localize(
|
|
1399
|
+
label: ( localize(11593, "Open user settings")),
|
|
1359
1400
|
run: () => {
|
|
1360
1401
|
this._commandService.executeCommand('workbench.action.openSettings', 'terminal.integrated.shellIntegration.enabled');
|
|
1361
1402
|
}
|
|
@@ -1457,7 +1498,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1457
1498
|
}
|
|
1458
1499
|
async _trust() {
|
|
1459
1500
|
return (await this._workspaceTrustRequestService.requestWorkspaceTrust({
|
|
1460
|
-
message: ( localize(
|
|
1501
|
+
message: ( localize(11594, "Creating a terminal process requires executing code"))
|
|
1461
1502
|
})) === true;
|
|
1462
1503
|
}
|
|
1463
1504
|
async _updateProcessCwd() {
|
|
@@ -1574,22 +1615,22 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1574
1615
|
const labelParts = [];
|
|
1575
1616
|
if (xterm && xterm.textarea) {
|
|
1576
1617
|
if (title && title.length > 0) {
|
|
1577
|
-
labelParts.push(( localize(
|
|
1618
|
+
labelParts.push(( localize(11595, "Terminal {0}, {1}", terminalId, title)));
|
|
1578
1619
|
}
|
|
1579
1620
|
else {
|
|
1580
|
-
labelParts.push(( localize(
|
|
1621
|
+
labelParts.push(( localize(11596, "Terminal {0}", terminalId)));
|
|
1581
1622
|
}
|
|
1582
1623
|
const screenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();
|
|
1583
1624
|
if (!screenReaderOptimized) {
|
|
1584
1625
|
labelParts.push(( localize(
|
|
1585
|
-
|
|
1626
|
+
11597,
|
|
1586
1627
|
"Run the command: Toggle Screen Reader Accessibility Mode for an optimized screen reader experience"
|
|
1587
1628
|
)));
|
|
1588
1629
|
}
|
|
1589
1630
|
const accessibilityHelpKeybinding = this._keybindingService.lookupKeybinding(AccessibilityCommandId.OpenAccessibilityHelp)?.getLabel();
|
|
1590
1631
|
if (this._configurationService.getValue(AccessibilityVerbositySettingId.Terminal) && accessibilityHelpKeybinding) {
|
|
1591
1632
|
labelParts.push(( localize(
|
|
1592
|
-
|
|
1633
|
+
11598,
|
|
1593
1634
|
"Use {0} for terminal accessibility help",
|
|
1594
1635
|
accessibilityHelpKeybinding
|
|
1595
1636
|
)));
|
|
@@ -1647,7 +1688,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1647
1688
|
}
|
|
1648
1689
|
async setFixedDimensions() {
|
|
1649
1690
|
const cols = await this._quickInputService.input({
|
|
1650
|
-
title: ( localize(
|
|
1691
|
+
title: ( localize(11599, "Set Fixed Dimensions: Column")),
|
|
1651
1692
|
placeHolder: 'Enter a number of columns or leave empty for automatic width',
|
|
1652
1693
|
validateInput: async (text) => text.length > 0 && !text.match(/^\d+$/) ? { content: 'Enter a number or leave empty size automatically', severity: Severity.Error } : undefined
|
|
1653
1694
|
});
|
|
@@ -1658,7 +1699,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1658
1699
|
this._labelComputer?.refreshLabel(this);
|
|
1659
1700
|
this._terminalHasFixedWidth.set(!!this._fixedCols);
|
|
1660
1701
|
const rows = await this._quickInputService.input({
|
|
1661
|
-
title: ( localize(
|
|
1702
|
+
title: ( localize(11600, "Set Fixed Dimensions: Row")),
|
|
1662
1703
|
placeHolder: 'Enter a number of rows or leave empty for automatic height',
|
|
1663
1704
|
validateInput: async (text) => text.length > 0 && !text.match(/^\d+$/) ? { content: 'Enter a number or leave empty size automatically', severity: Severity.Error } : undefined
|
|
1664
1705
|
});
|
|
@@ -1763,7 +1804,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1763
1804
|
_onEnvironmentVariableInfoChanged(info) {
|
|
1764
1805
|
if (info.requiresAction) {
|
|
1765
1806
|
this.xterm?.raw.textarea?.setAttribute('aria-label', ( localize(
|
|
1766
|
-
|
|
1807
|
+
11601,
|
|
1767
1808
|
"Terminal {0} environment is stale, run the 'Show Environment Information' command for more information",
|
|
1768
1809
|
this._instanceId
|
|
1769
1810
|
)));
|
|
@@ -1896,7 +1937,7 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1896
1937
|
disposables.push(quickPick);
|
|
1897
1938
|
quickPick.items = items;
|
|
1898
1939
|
quickPick.matchOnDescription = true;
|
|
1899
|
-
quickPick.placeholder = ( localize(
|
|
1940
|
+
quickPick.placeholder = ( localize(11602, 'Select a color for the terminal'));
|
|
1900
1941
|
quickPick.show();
|
|
1901
1942
|
const result = await ( new Promise(r => {
|
|
1902
1943
|
disposables.push(quickPick.onDidHide(() => r(undefined)));
|
|
@@ -1957,6 +1998,9 @@ let TerminalInstance = class TerminalInstance extends Disposable {
|
|
|
1957
1998
|
TerminalInstance.__decorator = ( __decorate([
|
|
1958
1999
|
debounce(50)
|
|
1959
2000
|
], TerminalInstance.prototype, "_fireMaximumDimensionsChanged", null));
|
|
2001
|
+
TerminalInstance.__decorator = ( __decorate([
|
|
2002
|
+
debounce(500)
|
|
2003
|
+
], TerminalInstance.prototype, "_refreshShellIntegrationInfoStatus", null));
|
|
1960
2004
|
TerminalInstance.__decorator = ( __decorate([
|
|
1961
2005
|
debounce(1000)
|
|
1962
2006
|
], TerminalInstance.prototype, "relaunch", null));
|
|
@@ -2217,27 +2261,27 @@ function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initi
|
|
|
2217
2261
|
if (processState === ProcessState.KilledDuringLaunch) {
|
|
2218
2262
|
if (commandLine) {
|
|
2219
2263
|
message = ( localize(
|
|
2220
|
-
|
|
2264
|
+
11603,
|
|
2221
2265
|
"The terminal process \"{0}\" failed to launch (exit code: {1}).",
|
|
2222
2266
|
commandLine,
|
|
2223
2267
|
code
|
|
2224
2268
|
));
|
|
2225
2269
|
}
|
|
2226
2270
|
else {
|
|
2227
|
-
message = ( localize(
|
|
2271
|
+
message = ( localize(11604, "The terminal process failed to launch (exit code: {0}).", code));
|
|
2228
2272
|
}
|
|
2229
2273
|
}
|
|
2230
2274
|
else {
|
|
2231
2275
|
if (commandLine) {
|
|
2232
2276
|
message = ( localize(
|
|
2233
|
-
|
|
2277
|
+
11605,
|
|
2234
2278
|
"The terminal process \"{0}\" terminated with exit code: {1}.",
|
|
2235
2279
|
commandLine,
|
|
2236
2280
|
code
|
|
2237
2281
|
));
|
|
2238
2282
|
}
|
|
2239
2283
|
else {
|
|
2240
|
-
message = ( localize(
|
|
2284
|
+
message = ( localize(11606, "The terminal process terminated with exit code: {0}.", code));
|
|
2241
2285
|
}
|
|
2242
2286
|
}
|
|
2243
2287
|
break;
|
|
@@ -2262,7 +2306,7 @@ function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initi
|
|
|
2262
2306
|
break;
|
|
2263
2307
|
}
|
|
2264
2308
|
}
|
|
2265
|
-
message = ( localize(
|
|
2309
|
+
message = ( localize(11607, "The terminal process failed to launch: {0}.", innerMessage));
|
|
2266
2310
|
break;
|
|
2267
2311
|
}
|
|
2268
2312
|
}
|
|
@@ -2298,7 +2342,8 @@ function guessShellTypeFromExecutable(os, executable) {
|
|
|
2298
2342
|
[GeneralShellType.Node, /^node$/],
|
|
2299
2343
|
[GeneralShellType.NuShell, /^nu$/],
|
|
2300
2344
|
[GeneralShellType.PowerShell, /^pwsh(-preview)?|powershell$/],
|
|
2301
|
-
[GeneralShellType.Python, /^py(?:thon)?$/]
|
|
2345
|
+
[GeneralShellType.Python, /^py(?:thon)?$/],
|
|
2346
|
+
[GeneralShellType.Xonsh, /^xonsh/]
|
|
2302
2347
|
]));
|
|
2303
2348
|
for (const [shellType, pattern] of generalShellTypeMap) {
|
|
2304
2349
|
if (exeBasename.match(pattern)) {
|
|
@@ -153,7 +153,7 @@ let TerminalProcessManager = class TerminalProcessManager extends Disposable {
|
|
|
153
153
|
}
|
|
154
154
|
catch (e) {
|
|
155
155
|
this._notificationService.notify({ message: ( localize(
|
|
156
|
-
|
|
156
|
+
11638,
|
|
157
157
|
'Could not kill process listening on port {0}, command exited with error {1}',
|
|
158
158
|
port,
|
|
159
159
|
e
|
|
@@ -431,7 +431,7 @@ let TerminalProcessManager = class TerminalProcessManager extends Disposable {
|
|
|
431
431
|
}
|
|
432
432
|
else {
|
|
433
433
|
const message = ( localize(
|
|
434
|
-
|
|
434
|
+
11639,
|
|
435
435
|
"Restarting the terminal because the connection to the shell process was lost..."
|
|
436
436
|
));
|
|
437
437
|
this._onProcessData.fire({ data: formatMessageForTerminal(message, { loudFormatting: true }), trackCommit: false });
|
|
@@ -32,9 +32,14 @@ export declare class TerminalTabList extends WorkbenchList<ITerminalInstance> {
|
|
|
32
32
|
private _decorationsProvider;
|
|
33
33
|
private _terminalTabsSingleSelectedContextKey;
|
|
34
34
|
private _isSplitContextKey;
|
|
35
|
+
private _hasText;
|
|
36
|
+
get hasText(): boolean;
|
|
37
|
+
private _hasActionBar;
|
|
38
|
+
get hasActionBar(): boolean;
|
|
35
39
|
constructor(container: HTMLElement, contextKeyService: IContextKeyService, listService: IListService, _configurationService: IConfigurationService, _terminalService: ITerminalService, _terminalGroupService: ITerminalGroupService, _terminalEditingService: ITerminalEditingService, instantiationService: IInstantiationService, decorationsService: IDecorationsService, _themeService: IThemeService, _storageService: IStorageService, lifecycleService: ILifecycleService, _hoverService: IHoverService);
|
|
36
40
|
private _getFocusMode;
|
|
37
41
|
refresh(cancelEditing?: boolean): void;
|
|
38
42
|
focusHover(): void;
|
|
39
43
|
private _updateContextKey;
|
|
44
|
+
layout(height?: number, width?: number): void;
|
|
40
45
|
}
|
|
@@ -64,11 +64,13 @@ var TerminalTabsListSizes;
|
|
|
64
64
|
TerminalTabsListSizes[TerminalTabsListSizes["MaximumWidth"] = 500] = "MaximumWidth";
|
|
65
65
|
})(TerminalTabsListSizes || (TerminalTabsListSizes = {}));
|
|
66
66
|
let TerminalTabList = class TerminalTabList extends WorkbenchList {
|
|
67
|
+
get hasText() { return this._hasText; }
|
|
68
|
+
get hasActionBar() { return this._hasActionBar; }
|
|
67
69
|
constructor(container, contextKeyService, listService, _configurationService, _terminalService, _terminalGroupService, _terminalEditingService, instantiationService, decorationsService, _themeService, _storageService, lifecycleService, _hoverService) {
|
|
68
70
|
super('TerminalTabsList', container, {
|
|
69
71
|
getHeight: () => TerminalTabsListSizes.TabHeight,
|
|
70
72
|
getTemplateId: () => 'terminal.tabs'
|
|
71
|
-
}, [instantiationService.createInstance(TerminalTabsRenderer, container, instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER), () => this.getSelectedElements())], {
|
|
73
|
+
}, [instantiationService.createInstance(TerminalTabsRenderer, container, instantiationService.createInstance(ResourceLabels, DEFAULT_LABELS_CONTAINER), () => this.getSelectedElements(), () => this.hasText, () => this.hasActionBar)], {
|
|
72
74
|
horizontalScrolling: false,
|
|
73
75
|
supportDynamicHeights: false,
|
|
74
76
|
selectionNavigation: true,
|
|
@@ -89,6 +91,8 @@ let TerminalTabList = class TerminalTabList extends WorkbenchList {
|
|
|
89
91
|
this._themeService = _themeService;
|
|
90
92
|
this._storageService = _storageService;
|
|
91
93
|
this._hoverService = _hoverService;
|
|
94
|
+
this._hasText = true;
|
|
95
|
+
this._hasActionBar = true;
|
|
92
96
|
const instanceDisposables = [
|
|
93
97
|
this._terminalGroupService.onDidChangeInstances(() => this.refresh()),
|
|
94
98
|
this._terminalGroupService.onDidChangeGroups(() => this.refresh()),
|
|
@@ -201,6 +205,17 @@ let TerminalTabList = class TerminalTabList extends WorkbenchList {
|
|
|
201
205
|
const instance = this.getFocusedElements();
|
|
202
206
|
this._isSplitContextKey.set(instance.length > 0 && this._terminalGroupService.instanceIsSplit(instance[0]));
|
|
203
207
|
}
|
|
208
|
+
layout(height, width) {
|
|
209
|
+
super.layout(height, width);
|
|
210
|
+
const actualWidth = width ?? this.getHTMLElement().clientWidth;
|
|
211
|
+
const newHasText = actualWidth >= TerminalTabsListSizes.MidpointViewWidth;
|
|
212
|
+
const newHasActionBar = actualWidth > TerminalTabsListSizes.ActionbarMinimumWidth;
|
|
213
|
+
if (this._hasText !== newHasText || this._hasActionBar !== newHasActionBar) {
|
|
214
|
+
this._hasText = newHasText;
|
|
215
|
+
this._hasActionBar = newHasActionBar;
|
|
216
|
+
this.refresh();
|
|
217
|
+
}
|
|
218
|
+
}
|
|
204
219
|
};
|
|
205
220
|
TerminalTabList = ( __decorate([
|
|
206
221
|
( __param(1, IContextKeyService)),
|
|
@@ -217,10 +232,11 @@ TerminalTabList = ( __decorate([
|
|
|
217
232
|
( __param(12, IHoverService))
|
|
218
233
|
], TerminalTabList));
|
|
219
234
|
let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
220
|
-
constructor(_container, _labels, _getSelection, _instantiationService, _terminalConfigurationService, _terminalService, _terminalGroupService, _terminalEditingService, _hoverService, _keybindingService, _listService, _storageService, _themeService, _contextViewService, _commandService) {
|
|
221
|
-
this._container = _container;
|
|
235
|
+
constructor(_container, _labels, _getSelection, _getHasText, _getHasActionBar, _instantiationService, _terminalConfigurationService, _terminalService, _terminalGroupService, _terminalEditingService, _hoverService, _keybindingService, _listService, _storageService, _themeService, _contextViewService, _commandService) {
|
|
222
236
|
this._labels = _labels;
|
|
223
237
|
this._getSelection = _getSelection;
|
|
238
|
+
this._getHasText = _getHasText;
|
|
239
|
+
this._getHasActionBar = _getHasActionBar;
|
|
224
240
|
this._instantiationService = _instantiationService;
|
|
225
241
|
this._terminalConfigurationService = _terminalConfigurationService;
|
|
226
242
|
this._terminalService = _terminalService;
|
|
@@ -234,7 +250,6 @@ let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
|
234
250
|
this._contextViewService = _contextViewService;
|
|
235
251
|
this._commandService = _commandService;
|
|
236
252
|
this.templateId = 'terminal.tabs';
|
|
237
|
-
this._cachedContainerWidth = -1;
|
|
238
253
|
}
|
|
239
254
|
renderTemplate(container) {
|
|
240
255
|
const element = append(container, $('.terminal-tabs-entry'));
|
|
@@ -277,21 +292,9 @@ let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
|
277
292
|
templateDisposables
|
|
278
293
|
};
|
|
279
294
|
}
|
|
280
|
-
shouldHideText() {
|
|
281
|
-
return this._container ? this.getContainerWidthCachedForTask() < TerminalTabsListSizes.MidpointViewWidth : false;
|
|
282
|
-
}
|
|
283
|
-
shouldHideActionBar() {
|
|
284
|
-
return this._container ? this.getContainerWidthCachedForTask() <= TerminalTabsListSizes.ActionbarMinimumWidth : false;
|
|
285
|
-
}
|
|
286
|
-
getContainerWidthCachedForTask() {
|
|
287
|
-
if (this._cachedContainerWidth === -1) {
|
|
288
|
-
this._cachedContainerWidth = this._container.clientWidth;
|
|
289
|
-
queueMicrotask(() => this._cachedContainerWidth = -1);
|
|
290
|
-
}
|
|
291
|
-
return this._cachedContainerWidth;
|
|
292
|
-
}
|
|
293
295
|
renderElement(instance, index, template) {
|
|
294
|
-
const hasText =
|
|
296
|
+
const hasText = this._getHasText();
|
|
297
|
+
const hasActionBar = this._getHasActionBar();
|
|
295
298
|
const group = this._terminalGroupService.getGroupForInstance(instance);
|
|
296
299
|
if (!group) {
|
|
297
300
|
throw ( new Error(`Could not find group for instance "${instance.instanceId}"`));
|
|
@@ -314,7 +317,6 @@ let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
|
314
317
|
const hoverInfo = getInstanceHoverInfo(instance, this._storageService);
|
|
315
318
|
template.context.hoverActions = hoverInfo.actions;
|
|
316
319
|
const iconId = this._instantiationService.invokeFunction(getIconId, instance);
|
|
317
|
-
const hasActionbar = !this.shouldHideActionBar();
|
|
318
320
|
let label = '';
|
|
319
321
|
if (!hasText) {
|
|
320
322
|
const primaryStatus = instance.statusList.primary;
|
|
@@ -332,7 +334,7 @@ let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
|
332
334
|
label += `$(${iconId}) ${instance.title}`;
|
|
333
335
|
}
|
|
334
336
|
}
|
|
335
|
-
if (!
|
|
337
|
+
if (!hasActionBar) {
|
|
336
338
|
template.actionBar.clear();
|
|
337
339
|
}
|
|
338
340
|
template.elementDisposables.add(addDisposableListener(template.element, EventType.AUXCLICK, e => {
|
|
@@ -388,7 +390,7 @@ let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
|
388
390
|
};
|
|
389
391
|
}
|
|
390
392
|
},
|
|
391
|
-
ariaLabel: ( localize(
|
|
393
|
+
ariaLabel: ( localize(11664, "Type terminal name. Press Enter to confirm or Escape to cancel.")),
|
|
392
394
|
inputBoxStyles: defaultInputBoxStyles
|
|
393
395
|
}));
|
|
394
396
|
inputBox.element.style.height = '22px';
|
|
@@ -508,25 +510,25 @@ let TerminalTabsRenderer = class TerminalTabsRenderer {
|
|
|
508
510
|
}
|
|
509
511
|
};
|
|
510
512
|
TerminalTabsRenderer = ( __decorate([
|
|
511
|
-
( __param(
|
|
512
|
-
( __param(
|
|
513
|
-
( __param(
|
|
514
|
-
( __param(
|
|
515
|
-
( __param(
|
|
516
|
-
( __param(
|
|
517
|
-
( __param(
|
|
518
|
-
( __param(
|
|
519
|
-
( __param(
|
|
520
|
-
( __param(
|
|
521
|
-
( __param(
|
|
522
|
-
( __param(
|
|
513
|
+
( __param(5, IInstantiationService)),
|
|
514
|
+
( __param(6, ITerminalConfigurationService)),
|
|
515
|
+
( __param(7, ITerminalService)),
|
|
516
|
+
( __param(8, ITerminalGroupService)),
|
|
517
|
+
( __param(9, ITerminalEditingService)),
|
|
518
|
+
( __param(10, IHoverService)),
|
|
519
|
+
( __param(11, IKeybindingService)),
|
|
520
|
+
( __param(12, IListService)),
|
|
521
|
+
( __param(13, IStorageService)),
|
|
522
|
+
( __param(14, IThemeService)),
|
|
523
|
+
( __param(15, IContextViewService)),
|
|
524
|
+
( __param(16, ICommandService))
|
|
523
525
|
], TerminalTabsRenderer));
|
|
524
526
|
let TerminalTabsAccessibilityProvider = class TerminalTabsAccessibilityProvider {
|
|
525
527
|
constructor(_terminalGroupService) {
|
|
526
528
|
this._terminalGroupService = _terminalGroupService;
|
|
527
529
|
}
|
|
528
530
|
getWidgetAriaLabel() {
|
|
529
|
-
return localize(
|
|
531
|
+
return localize(11665, "Terminal tabs");
|
|
530
532
|
}
|
|
531
533
|
getAriaLabel(instance) {
|
|
532
534
|
let ariaLabel = '';
|
|
@@ -534,7 +536,7 @@ let TerminalTabsAccessibilityProvider = class TerminalTabsAccessibilityProvider
|
|
|
534
536
|
if (tab && tab.terminalInstances?.length > 1) {
|
|
535
537
|
const terminalIndex = tab.terminalInstances.indexOf(instance);
|
|
536
538
|
ariaLabel = ( localize(
|
|
537
|
-
|
|
539
|
+
11666,
|
|
538
540
|
"Terminal {0} {1}, split {2} of {3}",
|
|
539
541
|
instance.instanceId,
|
|
540
542
|
instance.title,
|
|
@@ -543,7 +545,7 @@ let TerminalTabsAccessibilityProvider = class TerminalTabsAccessibilityProvider
|
|
|
543
545
|
));
|
|
544
546
|
}
|
|
545
547
|
else {
|
|
546
|
-
ariaLabel = ( localize(
|
|
548
|
+
ariaLabel = ( localize(11667, "Terminal {0} {1}", instance.instanceId, instance.title));
|
|
547
549
|
}
|
|
548
550
|
return ariaLabel;
|
|
549
551
|
}
|
|
@@ -720,7 +722,7 @@ let TabDecorationsProvider = class TabDecorationsProvider extends Disposable {
|
|
|
720
722
|
constructor(_terminalService) {
|
|
721
723
|
super();
|
|
722
724
|
this._terminalService = _terminalService;
|
|
723
|
-
this.label = ( localize(
|
|
725
|
+
this.label = ( localize(11668, "Terminal"));
|
|
724
726
|
this._onDidChange = this._register(( new Emitter()));
|
|
725
727
|
this.onDidChange = this._onDidChange.event;
|
|
726
728
|
this._register(this._terminalService.onAnyInstancePrimaryStatusChange(e => this._onDidChange.fire([e.resource])));
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
|
|
2
|
-
import { MarkdownString } from "@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent";
|
|
3
1
|
import type { IHoverAction } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hover";
|
|
2
|
+
import { MarkdownString } from "@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent";
|
|
4
3
|
import { type IStorageService } from "@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service";
|
|
4
|
+
import { ITerminalInstance } from "@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/terminal/browser/terminal";
|
|
5
5
|
export declare function getInstanceHoverInfo(instance: ITerminalInstance, storageService: IStorageService): {
|
|
6
6
|
content: MarkdownString;
|
|
7
7
|
actions: IHoverAction[];
|
|
8
8
|
};
|
|
9
9
|
export declare function getShellProcessTooltip(instance: ITerminalInstance, showDetailed: boolean): string;
|
|
10
|
-
export declare function refreshShellIntegrationInfoStatus(instance: ITerminalInstance): void;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
3
2
|
import { asArray } from '@codingame/monaco-vscode-api/vscode/vs/base/common/arrays';
|
|
4
3
|
import { MarkdownString } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import Severity from '@codingame/monaco-vscode-api/vscode/vs/base/common/severity';
|
|
4
|
+
import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
5
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
8
6
|
import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
|
|
9
7
|
import { TerminalStorageKeys } from '../common/terminalStorageKeys.js';
|
|
10
|
-
import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
|
|
11
8
|
|
|
12
9
|
function getInstanceHoverInfo(instance, storageService) {
|
|
13
10
|
const showDetailed = parseInt(storageService.get(TerminalStorageKeys.TabsShowDetailed, StorageScope.APPLICATION) ?? '0');
|
|
@@ -31,7 +28,7 @@ function getInstanceHoverInfo(instance, storageService) {
|
|
|
31
28
|
}
|
|
32
29
|
actions.push({
|
|
33
30
|
commandId: 'toggleDetailedInfo',
|
|
34
|
-
label: showDetailed ? ( localize(
|
|
31
|
+
label: showDetailed ? ( localize(11669, 'Hide Details')) : ( localize(11670, 'Show Details')),
|
|
35
32
|
run() {
|
|
36
33
|
storageService.store(TerminalStorageKeys.TabsShowDetailed, (showDetailed + 1) % 2, StorageScope.APPLICATION, StorageTarget.USER);
|
|
37
34
|
},
|
|
@@ -46,7 +43,7 @@ function getInstanceHoverInfo(instance, storageService) {
|
|
|
46
43
|
function getShellProcessTooltip(instance, showDetailed) {
|
|
47
44
|
const lines = [];
|
|
48
45
|
if (instance.processId && instance.processId > 0) {
|
|
49
|
-
lines.push(( localize(
|
|
46
|
+
lines.push(( localize(11671, "Process ID ({0}): {1}", 'PID', instance.processId)) + '\n');
|
|
50
47
|
}
|
|
51
48
|
if (instance.shellLaunchConfig.executable) {
|
|
52
49
|
let commandLine = '';
|
|
@@ -63,50 +60,9 @@ function getShellProcessTooltip(instance, showDetailed) {
|
|
|
63
60
|
if (args) {
|
|
64
61
|
commandLine += ` ${args}`;
|
|
65
62
|
}
|
|
66
|
-
lines.push(( localize(
|
|
63
|
+
lines.push(( localize(11672, 'Command line: {0}', commandLine)));
|
|
67
64
|
}
|
|
68
65
|
return lines.length ? `\n\n---\n\n${lines.join('\n')}` : '';
|
|
69
66
|
}
|
|
70
|
-
function refreshShellIntegrationInfoStatus(instance) {
|
|
71
|
-
if (!instance.xterm) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const cmdDetectionType = (instance.capabilities.get(TerminalCapability.CommandDetection)?.hasRichCommandDetection
|
|
75
|
-
? ( localize(11638, 'Rich'))
|
|
76
|
-
: ( instance.capabilities.has(TerminalCapability.CommandDetection))
|
|
77
|
-
? ( localize(11639, 'Basic'))
|
|
78
|
-
: instance.usedShellIntegrationInjection
|
|
79
|
-
? ( localize(11640, "Injection failed to activate"))
|
|
80
|
-
: ( localize(11641, 'No')));
|
|
81
|
-
const detailedAdditions = [];
|
|
82
|
-
if (instance.shellType) {
|
|
83
|
-
detailedAdditions.push(`Shell type: \`${instance.shellType}\``);
|
|
84
|
-
}
|
|
85
|
-
const cwd = instance.cwd;
|
|
86
|
-
if (cwd) {
|
|
87
|
-
detailedAdditions.push(`Current working directory: \`${cwd}\``);
|
|
88
|
-
}
|
|
89
|
-
const seenSequences = Array.from(instance.xterm.shellIntegration.seenSequences);
|
|
90
|
-
if (seenSequences.length > 0) {
|
|
91
|
-
detailedAdditions.push(`Seen sequences: ${( seenSequences.map(e => `\`${e}\``)).join(', ')}`);
|
|
92
|
-
}
|
|
93
|
-
const promptType = instance.capabilities.get(TerminalCapability.PromptTypeDetection)?.promptType;
|
|
94
|
-
if (promptType) {
|
|
95
|
-
detailedAdditions.push(`Prompt type: \`${promptType}\``);
|
|
96
|
-
}
|
|
97
|
-
const combinedString = instance.capabilities.get(TerminalCapability.CommandDetection)?.promptInputModel.getCombinedString();
|
|
98
|
-
if (combinedString !== undefined) {
|
|
99
|
-
detailedAdditions.push(`Prompt input: \`\`\`${combinedString}\`\`\``);
|
|
100
|
-
}
|
|
101
|
-
const detailedAdditionsString = detailedAdditions.length > 0
|
|
102
|
-
? '\n\n' + ( detailedAdditions.map(e => `- ${e}`)).join('\n')
|
|
103
|
-
: '';
|
|
104
|
-
instance.statusList.add({
|
|
105
|
-
id: TerminalStatus.ShellIntegrationInfo,
|
|
106
|
-
severity: Severity.Info,
|
|
107
|
-
tooltip: `${( localize(11642, "Shell integration"))}: ${cmdDetectionType}`,
|
|
108
|
-
detailedTooltip: `${( localize(11642, "Shell integration"))}: ${cmdDetectionType}${detailedAdditionsString}`
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
67
|
|
|
112
|
-
export { getInstanceHoverInfo, getShellProcessTooltip
|
|
68
|
+
export { getInstanceHoverInfo, getShellProcessTooltip };
|