File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from "vite-plus/test" ;
2+
3+ import { formatWorkspaceRelativePath } from "./filePathDisplay" ;
4+
5+ describe ( "formatWorkspaceRelativePath" , ( ) => {
6+ it ( "leaves Windows absolute paths outside the workspace alone" , ( ) => {
7+ expect (
8+ formatWorkspaceRelativePath (
9+ "C:\\Users\\mike\\.claude\\settings.json:3" ,
10+ "C:\\Users\\mike\\dev-stuff\\t3code" ,
11+ ) ,
12+ ) . toBe ( "C:/Users/mike/.claude/settings.json:3" ) ;
13+ expect (
14+ formatWorkspaceRelativePath ( "D:/data/report.csv" , "C:/Users/mike/dev-stuff/t3code" ) ,
15+ ) . toBe ( "D:/data/report.csv" ) ;
16+ } ) ;
17+
18+ it ( "still labels relative and in-workspace paths with the workspace name" , ( ) => {
19+ expect ( formatWorkspaceRelativePath ( "src/app.ts" , "C:/Users/mike/dev-stuff/t3code" ) ) . toBe (
20+ "t3code/src/app.ts" ,
21+ ) ;
22+ expect (
23+ formatWorkspaceRelativePath (
24+ "c:\\users\\mike\\dev-stuff\\t3code\\src\\app.ts:7" ,
25+ "C:\\Users\\mike\\dev-stuff\\t3code" ,
26+ ) ,
27+ ) . toBe ( "t3code/src/app.ts:7" ) ;
28+ } ) ;
29+ } ) ;
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ export function formatWorkspaceRelativePath(
4646 } else if ( pathForCompare . startsWith ( workspaceWithSeparator ) ) {
4747 const relativeSuffix = normalizedPath . slice ( normalizedWorkspaceRoot . length + 1 ) ;
4848 displayPath = `${ workspaceLabel } /${ relativeSuffix } ` ;
49- } else if ( ! normalizedPath . startsWith ( "/" ) ) {
49+ } else if ( ! normalizedPath . startsWith ( "/" ) && ! isWindowsAbsolutePath ( normalizedPath ) ) {
5050 const relativePath = stripRelativePrefixes ( normalizedPath ) ;
5151 displayPath = pathForCompare . startsWith ( workspaceLabelWithSeparator )
5252 ? normalizedPath
You can’t perform that action at this time.
0 commit comments