mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Autodetect rust library source file map
This commit is contained in:
parent
d1c9bd134d
commit
8f781e782c
2 changed files with 31 additions and 2 deletions
|
@ -3,7 +3,7 @@ import * as vscode from 'vscode';
|
|||
import * as path from 'path';
|
||||
import * as ra from './lsp_ext';
|
||||
|
||||
import { Cargo } from './toolchain';
|
||||
import { Cargo, sysrootForDir as getSysroot } from './toolchain';
|
||||
import { Ctx } from "./ctx";
|
||||
import { prepareEnv } from "./run";
|
||||
|
||||
|
@ -104,7 +104,15 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
|
|||
|
||||
const executable = await getDebugExecutable(runnable);
|
||||
const env = prepareEnv(runnable, ctx.config.runnableEnv);
|
||||
const debugConfig = knownEngines[debugEngine.id](runnable, simplifyPath(executable), env, debugOptions.sourceFileMap);
|
||||
let sourceFileMap = debugOptions.sourceFileMap;
|
||||
if ( !sourceFileMap || Object.keys(sourceFileMap).length === 0 ) {
|
||||
// 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 debugConfig = knownEngines[debugEngine.id](runnable, simplifyPath(executable), env, sourceFileMap);
|
||||
if (debugConfig.type in debugOptions.engineSettings) {
|
||||
const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type];
|
||||
for (var key in settingsMap) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue