@@ -6,7 +6,7 @@ import type * as ra from "./lsp_ext";
66import { Cargo } from "./toolchain" ;
77import type { Ctx } from "./ctx" ;
88import { createTaskFromRunnable , prepareEnv } from "./run" ;
9- import { execute , isCargoRunnableArgs , unwrapUndefinable , log } from "./util" ;
9+ import { execute , isCargoRunnableArgs , unwrapUndefinable , log , normalizeDriveLetter } from "./util" ;
1010import type { Config } from "./config" ;
1111
1212// Here we want to keep track on everything that's currently running
@@ -127,20 +127,14 @@ async function getDebugConfiguration(
127127 firstWorkspace ;
128128
129129 const workspace = unwrapUndefinable ( maybeWorkspace ) ;
130- let wsFolder = path . normalize ( workspace . uri . fsPath ) ;
131- if ( os . platform ( ) === "win32" ) {
132- // in windows, the drive letter can vary in casing for VSCode, so we gotta normalize that first
133- wsFolder = wsFolder . replace ( / ^ [ a - z ] : \\ / , ( c ) => c . toUpperCase ( ) ) ;
134- }
130+ const wsFolder = normalizeDriveLetter ( path . normalize ( workspace . uri . fsPath ) ) ;
135131
136132 const workspaceQualifier = isMultiFolderWorkspace ? `:${ workspace . name } ` : "" ;
137133 function simplifyPath ( p : string ) : string {
138134 // in windows, the drive letter can vary in casing for VSCode, so we gotta normalize that first
139- if ( os . platform ( ) === "win32" ) {
140- p = p . replace ( / ^ [ a - z ] : \\ / , ( c ) => c . toUpperCase ( ) ) ;
141- }
135+ p = normalizeDriveLetter ( path . normalize ( p ) ) ;
142136 // see https://github.com/rust-lang/rust-analyzer/pull/5513#issuecomment-663458818 for why this is needed
143- return path . normalize ( p ) . replace ( wsFolder , `\${workspaceFolder${ workspaceQualifier } }` ) ;
137+ return p . replace ( wsFolder , `\${workspaceFolder${ workspaceQualifier } }` ) ;
144138 }
145139
146140 const executable = await getDebugExecutable (
0 commit comments