Skip to content

Terminal tab title: Show "~" instead of "$HOME" - #275378

Merged
Dmitriy Vasyura (dmitrivMS) merged 5 commits into
microsoft:mainfrom
jdanbrown:terminal-title-tilde
Jul 29, 2026
Merged

Terminal tab title: Show "~" instead of "$HOME"#275378
Dmitriy Vasyura (dmitrivMS) merged 5 commits into
microsoft:mainfrom
jdanbrown:terminal-title-tilde

Conversation

@jdanbrown

@jdanbrown Dan Brown (jdanbrown) commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

Fixes #274200

Copilot AI review requested due to automatic review settings November 4, 2025 22:40
@jdanbrown

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@jdanbrown

Copy link
Copy Markdown
Contributor Author

👋 Megan Rogge (@meganrogge) I made this PR for #274200, which you got assigned to.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for tildifying (replacing user home paths with ~) in terminal instance labels. When displaying terminal working directories, paths under the user's home directory now show as ~/path instead of /home/user/path.

Key changes:

  • Modified terminal label computation to use the tildify utility function for CWD paths
  • Added special handling for the exact user home path to display as ~
  • Updated test fixtures to include a default userHome value and added test cases for tildification scenarios

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Imports tildify function, adds os to type signatures, implements tildification logic for CWD paths in label computation
src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts Updates default userHome in test fixture from undefined to /home/user, adds three new test cases for tildification behavior
Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts:305

  • The return type of createInstance is missing the os property that was added to the refreshLabel and computeLabel method signatures in the production code. This type mismatch could cause the tests to not properly validate the OS-specific behavior of tildification.
		function createInstance(partial?: Partial<ITerminalInstance>): Pick<ITerminalInstance, 'shellLaunchConfig' | 'shellType' | 'userHome' | 'cwd' | 'initialCwd' | 'processName' | 'sequence' | 'workspaceFolder' | 'staticTitle' | 'capabilities' | 'title' | 'description'> {

Comment thread src/vs/workbench/contrib/terminal/browser/terminalInstance.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jdanbrown

Copy link
Copy Markdown
Contributor Author

Hi Megan Rogge (@meganrogge), will you or someone else be able to review this to get it merged? It's a pretty trivial code change for a small but meaningful UI improvement.

@meganrogge Megan Rogge (meganrogge) added this to the December 2025 milestone Jan 5, 2026
@meganrogge
Megan Rogge (meganrogge) enabled auto-merge (squash) January 5, 2026 19:31

@meganrogge Megan Rogge (meganrogge) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@Tyriar

Copy link
Copy Markdown
Contributor

Failing tests on Windows

# Conflicts:
#	src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

Anthony Kim (@anthonykim1)

Matched files:

  • src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
  • src/vs/workbench/contrib/terminal/test/browser/terminalInstance.test.ts

@dmitrivMS
Dmitriy Vasyura (dmitrivMS) enabled auto-merge (squash) July 28, 2026 00:15
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit f8f7ae2 into microsoft:main Jul 29, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.132.0 milestone Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal tab title: Show "~" instead of $HOME

9 participants