@@ -6,7 +6,7 @@ import type * as ra from "./lsp_ext";
6
6
import { Cargo } from "./toolchain" ;
7
7
import type { Ctx } from "./ctx" ;
8
8
import { createTaskFromRunnable , prepareEnv } from "./run" ;
9
- import { execute , isCargoRunnableArgs , unwrapUndefinable , log } from "./util" ;
9
+ import { execute , isCargoRunnableArgs , unwrapUndefinable , log , normalizeDriveLetter } from "./util" ;
10
10
import type { Config } from "./config" ;
11
11
12
12
// Here we want to keep track on everything that's currently running
@@ -127,20 +127,14 @@ async function getDebugConfiguration(
127
127
firstWorkspace ;
128
128
129
129
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 ) ) ;
135
131
136
132
const workspaceQualifier = isMultiFolderWorkspace ? `:${ workspace . name } ` : "" ;
137
133
function simplifyPath ( p : string ) : string {
138
134
// 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 ) ) ;
142
136
// 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 } }` ) ;
144
138
}
145
139
146
140
const executable = await getDebugExecutable (
0 commit comments