diff --git a/src/vs/workbench/contrib/terminal/browser/media/terminal.css b/src/vs/workbench/contrib/terminal/browser/media/terminal.css index 9370b48b871f6d..d06a2144d63f3d 100644 --- a/src/vs/workbench/contrib/terminal/browser/media/terminal.css +++ b/src/vs/workbench/contrib/terminal/browser/media/terminal.css @@ -474,9 +474,18 @@ display: block; } +.monaco-action-bar .action-item:has(> .single-terminal-tab) { + flex: 1; + min-width: 0; + overflow: hidden; +} + .monaco-action-bar .action-item .single-terminal-tab { display: flex !important; align-items: center; + overflow: hidden; + min-width: 0; + white-space: nowrap; } .monaco-action-bar .action-item .single-terminal-tab .codicon:first-child { diff --git a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts index 419fcddfbb85ae..a8b276c11ce12a 100644 --- a/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts +++ b/src/vs/workbench/contrib/terminal/browser/terminalInstance.ts @@ -2717,7 +2717,7 @@ export class TerminalLabelComputer extends Disposable { super(); } - refreshLabel(instance: Pick, reset?: boolean): void { + refreshLabel(instance: Pick, reset?: boolean): void { const tabs = this._terminalConfigurationService.config.tabs; const useAgentCliTitle = tabs.allowAgentCliTitle && TerminalLabelComputer.agentCliShellTypes.has(instance.shellType as GeneralShellType); const titleTemplate = instance.shellLaunchConfig.titleTemplate ?? (useAgentCliTitle ? '${sequence}' : tabs.title); diff --git a/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts b/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts index 6797f7d6c464c8..c03c5cfbd9277b 100644 --- a/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts +++ b/src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts @@ -398,7 +398,7 @@ suite('Workbench - TerminalInstance', () => { let instantiationService: TestInstantiationService; let capabilities: TerminalCapabilityStore; - function createInstance(partial?: Partial): Pick { + function createInstance(partial?: Partial): Pick { const capabilities = store.add(new TerminalCapabilityStore()); if (!isWindows) { capabilities.add(TerminalCapability.NaiveCwdDetection, null!); @@ -416,6 +416,7 @@ suite('Workbench - TerminalInstance', () => { title: '', description: '', userHome: undefined, + progressState: undefined, ...partial }; } @@ -553,6 +554,36 @@ suite('Workbench - TerminalInstance', () => { strictEqual(terminalLabelComputer.description, 'root2'); } }); + test('should resolve progress state 0 (no progress) as empty string', () => { + const terminalLabelComputer = createLabelComputer({ terminal: { integrated: { tabs: { separator: ' - ', title: '${process}${separator}${progress}', description: '' } } } }); + terminalLabelComputer.refreshLabel(createInstance({ capabilities, processName: 'bash', progressState: { state: 0, value: 0 } })); + strictEqual(terminalLabelComputer.title, 'bash'); + }); + test('should resolve progress state 1 (normal) as percentage', () => { + const terminalLabelComputer = createLabelComputer({ terminal: { integrated: { tabs: { separator: ' - ', title: '${process}${separator}${progress}', description: '' } } } }); + terminalLabelComputer.refreshLabel(createInstance({ capabilities, processName: 'bash', progressState: { state: 1, value: 75 } })); + strictEqual(terminalLabelComputer.title, 'bash - 75%'); + }); + test('should resolve progress state 2 (error) as error icon', () => { + const terminalLabelComputer = createLabelComputer({ terminal: { integrated: { tabs: { separator: ' - ', title: '${process}${separator}${progress}', description: '' } } } }); + terminalLabelComputer.refreshLabel(createInstance({ capabilities, processName: 'bash', progressState: { state: 2, value: 0 } })); + strictEqual(terminalLabelComputer.title, 'bash - $(error)'); + }); + test('should resolve progress state 3 (indeterminate) as loading icon', () => { + const terminalLabelComputer = createLabelComputer({ terminal: { integrated: { tabs: { separator: ' - ', title: '${process}${separator}${progress}', description: '' } } } }); + terminalLabelComputer.refreshLabel(createInstance({ capabilities, processName: 'bash', progressState: { state: 3, value: 0 } })); + strictEqual(terminalLabelComputer.title, 'bash - $(loading~spin)'); + }); + test('should resolve progress state 4 (warning) as alert icon', () => { + const terminalLabelComputer = createLabelComputer({ terminal: { integrated: { tabs: { separator: ' - ', title: '${process}${separator}${progress}', description: '' } } } }); + terminalLabelComputer.refreshLabel(createInstance({ capabilities, processName: 'bash', progressState: { state: 4, value: 0 } })); + strictEqual(terminalLabelComputer.title, 'bash - $(alert)'); + }); + test('should resolve progress as empty when progressState is undefined', () => { + const terminalLabelComputer = createLabelComputer({ terminal: { integrated: { tabs: { separator: ' - ', title: '${process}${separator}${progress}', description: '' } } } }); + terminalLabelComputer.refreshLabel(createInstance({ capabilities, processName: 'bash', progressState: undefined })); + strictEqual(terminalLabelComputer.title, 'bash'); + }); }); suite('getCwdResource', () => {