mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
fix array sourceMap
This commit is contained in:
parent
82b114dbf0
commit
64caa6bbf1
1 changed files with 18 additions and 8 deletions
|
@ -6,6 +6,7 @@ import type * as ra from "./lsp_ext";
|
||||||
import { Cargo } from "./toolchain";
|
import { Cargo } from "./toolchain";
|
||||||
import type { Ctx } from "./ctx";
|
import type { Ctx } from "./ctx";
|
||||||
import { createTaskFromRunnable, prepareEnv } from "./run";
|
import { createTaskFromRunnable, prepareEnv } from "./run";
|
||||||
|
import { execSync } from 'node:child_process'
|
||||||
import { execute, isCargoRunnableArgs, unwrapUndefinable } from "./util";
|
import { execute, isCargoRunnableArgs, unwrapUndefinable } from "./util";
|
||||||
import type { Config } from "./config";
|
import type { Config } from "./config";
|
||||||
|
|
||||||
|
@ -109,9 +110,9 @@ async function getDebugConfiguration(
|
||||||
|
|
||||||
await vscode.window.showErrorMessage(
|
await vscode.window.showErrorMessage(
|
||||||
`Install [CodeLLDB](command:${commandCodeLLDB} "Open CodeLLDB")` +
|
`Install [CodeLLDB](command:${commandCodeLLDB} "Open CodeLLDB")` +
|
||||||
`, [lldb-dap](command:${commandLLDBDap} "Open lldb-dap")` +
|
`, [lldb-dap](command:${commandLLDBDap} "Open lldb-dap")` +
|
||||||
`, [C/C++](command:${commandCCpp} "Open C/C++") ` +
|
`, [C/C++](command:${commandCCpp} "Open C/C++") ` +
|
||||||
`or [Native Debug](command:${commandNativeDebug} "Open Native Debug") for debugging.`,
|
`or [Native Debug](command:${commandNativeDebug} "Open Native Debug") for debugging.`,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +130,7 @@ async function getDebugConfiguration(
|
||||||
!isMultiFolderWorkspace || !runnableArgs.workspaceRoot
|
!isMultiFolderWorkspace || !runnableArgs.workspaceRoot
|
||||||
? firstWorkspace
|
? firstWorkspace
|
||||||
: workspaceFolders.find((w) => runnableArgs.workspaceRoot?.includes(w.uri.fsPath)) ||
|
: workspaceFolders.find((w) => runnableArgs.workspaceRoot?.includes(w.uri.fsPath)) ||
|
||||||
firstWorkspace;
|
firstWorkspace;
|
||||||
|
|
||||||
const workspace = unwrapUndefinable(maybeWorkspace);
|
const workspace = unwrapUndefinable(maybeWorkspace);
|
||||||
let wsFolder = path.normalize(workspace.uri.fsPath);
|
let wsFolder = path.normalize(workspace.uri.fsPath);
|
||||||
|
@ -227,16 +228,25 @@ const knownEngines: {
|
||||||
"ms-vscode.cpptools": DebugConfigProvider<"cppvsdbg" | "cppdbg", CCppDebugConfig>;
|
"ms-vscode.cpptools": DebugConfigProvider<"cppvsdbg" | "cppdbg", CCppDebugConfig>;
|
||||||
"webfreak.debug": DebugConfigProvider<"gdb", NativeDebugConfig>;
|
"webfreak.debug": DebugConfigProvider<"gdb", NativeDebugConfig>;
|
||||||
} = {
|
} = {
|
||||||
"llvm-vs-code-extensions.lldb-dap":{
|
"llvm-vs-code-extensions.lldb-dap": {
|
||||||
type: "lldb-dap",
|
type: "lldb-dap",
|
||||||
executableProperty: "program",
|
executableProperty: "program",
|
||||||
environmentProperty: (env) => ["env", Object.entries(env).map(([k,v])=>`${k}=${v}`)],
|
environmentProperty: (env) => ["env", Object.entries(env).map(([k, v]) => `${k}=${v}`)],
|
||||||
runnableArgsProperty: (runnableArgs: ra.CargoRunnableArgs) => [
|
runnableArgsProperty: (runnableArgs: ra.CargoRunnableArgs) => [
|
||||||
"args",
|
"args",
|
||||||
runnableArgs.executableArgs,
|
runnableArgs.executableArgs,
|
||||||
],
|
],
|
||||||
|
additional: {
|
||||||
|
"sourceMap": [
|
||||||
|
[
|
||||||
|
`/rustc/${/commit-hash:\s(.*)$/m.exec(execSync("rustc -V -v", {}).toString())?.[1]
|
||||||
|
}/library`,
|
||||||
|
"${config:rust-analyzer.cargo.sysroot}/lib/rustlib/src/rust/library"
|
||||||
|
|
||||||
},
|
]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"vadimcn.vscode-lldb": {
|
"vadimcn.vscode-lldb": {
|
||||||
type: "lldb",
|
type: "lldb",
|
||||||
executableProperty: "program",
|
executableProperty: "program",
|
||||||
|
@ -353,7 +363,7 @@ type LldbDapDebugConfig = {
|
||||||
program: string;
|
program: string;
|
||||||
args: string[];
|
args: string[];
|
||||||
env: string[];
|
env: string[];
|
||||||
sourceMap: [string,string][];
|
sourceMap: [string, string][];
|
||||||
} & BaseDebugConfig<"lldb-dap">;
|
} & BaseDebugConfig<"lldb-dap">;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue