Terminal tab title: Show "~" instead of "$HOME" - #275378
Conversation
|
@microsoft-github-policy-service agree |
|
👋 Megan Rogge (@meganrogge) I made this PR for #274200, which you got assigned to. |
There was a problem hiding this comment.
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
tildifyutility function for CWD paths - Added special handling for the exact user home path to display as
~ - Updated test fixtures to include a default
userHomevalue 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
createInstanceis missing theosproperty that was added to therefreshLabelandcomputeLabelmethod 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'> {
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
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. |
Megan Rogge (meganrogge)
left a comment
There was a problem hiding this comment.
LGTM, thanks!
|
Failing tests on Windows |
# Conflicts: # src/vs/workbench/contrib/terminal/browser/terminalInstance.ts
b1c95b2
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Anthony Kim (@anthonykim1)Matched files:
|
Fixes #274200