mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Add special auto
value for debug.sourceFileMap
This commit is contained in:
parent
8f781e782c
commit
1ebfe11730
5 changed files with 38 additions and 27 deletions
|
@ -3,7 +3,7 @@ import * as vscode from 'vscode';
|
|||
import * as path from 'path';
|
||||
import * as ra from './lsp_ext';
|
||||
|
||||
import { Cargo, sysrootForDir as getSysroot } from './toolchain';
|
||||
import { Cargo, getSysroot } from './toolchain';
|
||||
import { Ctx } from "./ctx";
|
||||
import { prepareEnv } from "./run";
|
||||
|
||||
|
@ -105,11 +105,11 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
|
|||
const executable = await getDebugExecutable(runnable);
|
||||
const env = prepareEnv(runnable, ctx.config.runnableEnv);
|
||||
let sourceFileMap = debugOptions.sourceFileMap;
|
||||
if ( !sourceFileMap || Object.keys(sourceFileMap).length === 0 ) {
|
||||
if (sourceFileMap === "auto") {
|
||||
// let's try to use the default toolchain
|
||||
const sysroot = await getSysroot(wsFolder);
|
||||
const rustlib_src = path.normalize(sysroot + "/lib/rustlib/src/rust");
|
||||
sourceFileMap = { "/rustc/*": rustlib_src };
|
||||
const rustlib = path.normalize(sysroot + "/lib/rustlib/src/rust");
|
||||
sourceFileMap = { "/rustc/*": rustlib };
|
||||
}
|
||||
|
||||
const debugConfig = knownEngines[debugEngine.id](runnable, simplifyPath(executable), env, sourceFileMap);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue