File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,18 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
87
87
debugOutput . show ( true ) ;
88
88
}
89
89
90
- const wsFolder = path . normalize ( vscode . workspace . workspaceFolders ! [ 0 ] . uri . fsPath ) ; // folder exists or RA is not active.
90
+
91
+ const isMultiFolderWorkspace = vscode . workspace . workspaceFolders ! . length > 1 ;
92
+ const firstWorkspace = vscode . workspace . workspaceFolders ! [ 0 ] ; // folder exists or RA is not active.
93
+ const workspace = ! isMultiFolderWorkspace || ! runnable . args . workspaceRoot ?
94
+ firstWorkspace :
95
+ vscode . workspace . workspaceFolders ! . find ( w => runnable . args . workspaceRoot ?. includes ( w . uri . fsPath ) ) || firstWorkspace ;
96
+
97
+ const wsFolder = path . normalize ( workspace . uri . fsPath ) ;
98
+ const workspaceQualifier = isMultiFolderWorkspace ? `:${ workspace . name } ` : '' ;
91
99
function simplifyPath ( p : string ) : string {
92
- return path . normalize ( p ) . replace ( wsFolder , '${workspaceRoot}' ) ;
100
+ // see https://github.com/rust-analyzer/rust-analyzer/pull/5513#issuecomment-663458818 for why this is needed
101
+ return path . normalize ( p ) . replace ( wsFolder , '${workspaceFolder' + workspaceQualifier + '}' ) ;
93
102
}
94
103
95
104
const executable = await getDebugExecutable ( runnable ) ;
You can’t perform that action at this time.
0 commit comments