From b32528659a64f74da4b652c44b9fb47844899809 Mon Sep 17 00:00:00 2001 From: Urban Dove Date: Sat, 25 Jul 2020 22:16:35 -0400 Subject: try select correct workspace in vscode multi workspace --- editors/code/src/debug.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'editors/code') diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index bd92c5b6d..1427ecf9a 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -87,9 +87,18 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise 1; + const firstWorkspace = vscode.workspace.workspaceFolders![0]; // folder exists or RA is not active. + const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ? + firstWorkspace : + vscode.workspace.workspaceFolders!.find(w => runnable.args.workspaceRoot?.includes(w.uri.fsPath)) || firstWorkspace; + + const wsFolder = path.normalize(workspace.uri.fsPath); + const workspaceQualifier = isMultiFolderWorkspace ? `:${workspace.name}` : ''; function simplifyPath(p: string): string { - return path.normalize(p).replace(wsFolder, '${workspaceRoot}'); + // see https://github.com/rust-analyzer/rust-analyzer/pull/5513#issuecomment-663458818 for why this is needed + return path.normalize(p).replace(wsFolder, '${workspaceFolder' + workspaceQualifier + '}'); } const executable = await getDebugExecutable(runnable); -- cgit v1.2.3 From a85e64770d13598103c9122c6514ec3d5a3b0d53 Mon Sep 17 00:00:00 2001 From: Urban Dove Date: Sun, 26 Jul 2020 13:42:17 -0400 Subject: delete empty line --- editors/code/src/debug.ts | 1 - 1 file changed, 1 deletion(-) (limited to 'editors/code') diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 1427ecf9a..925126a16 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -87,7 +87,6 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise 1; const firstWorkspace = vscode.workspace.workspaceFolders![0]; // folder exists or RA is not active. const workspace = !isMultiFolderWorkspace || !runnable.args.workspaceRoot ? -- cgit v1.2.3