From 87baa0e380966c02afee8ecf319265d3d1ba1041 Mon Sep 17 00:00:00 2001 From: kouhe3 <25522053+kouhe3@users.noreply.github.com> Date: Tue, 8 Oct 2024 00:22:58 +0800 Subject: add knownEngines lldb-dap --- src/tools/rust-analyzer/editors/code/src/debug.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/tools/rust-analyzer/editors/code') diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index fb7e340e517..8ccc80b2be1 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -105,9 +105,11 @@ async function getDebugConfiguration( const commandCCpp: string = createCommandLink("ms-vscode.cpptools"); const commandCodeLLDB: string = createCommandLink("vadimcn.vscode-lldb"); const commandNativeDebug: string = createCommandLink("webfreak.debug"); + const commandLLDBDap: string = createCommandLink("llvm-vs-code-extensions.lldb-dap"); await vscode.window.showErrorMessage( `Install [CodeLLDB](command:${commandCodeLLDB} "Open CodeLLDB")` + + `, [lldb-dap](command:${commandLLDBDap} "Open lldb-dap")` + `, [C/C++](command:${commandCCpp} "Open C/C++") ` + `or [Native Debug](command:${commandNativeDebug} "Open Native Debug") for debugging.`, ); @@ -220,10 +222,21 @@ type DebugConfigProvider; "vadimcn.vscode-lldb": DebugConfigProvider<"lldb", CodeLldbDebugConfig>; "ms-vscode.cpptools": DebugConfigProvider<"cppvsdbg" | "cppdbg", CCppDebugConfig>; "webfreak.debug": DebugConfigProvider<"gdb", NativeDebugConfig>; } = { + "llvm-vs-code-extensions.lldb-dap":{ + type: "lldb-dap", + executableProperty: "program", + environmentProperty: (env) => ["env", env], + runnableArgsProperty: (runnableArgs: ra.CargoRunnableArgs) => [ + "args", + runnableArgs.executableArgs, + ], + +}, "vadimcn.vscode-lldb": { type: "lldb", executableProperty: "program", @@ -336,6 +349,13 @@ type CCppDebugConfig = { }; } & BaseDebugConfig<"cppvsdbg" | "cppdbg">; +type LldbDapDebugConfig = { + program: string; + args: string[]; + env: Record; +} & BaseDebugConfig<"lldb-dap">; + + type CodeLldbDebugConfig = { program: string; args: string[]; -- cgit 1.4.1-3-g733a5 From 90e3c8885cc53cc0c5be5b27612d82ac5c7c5b38 Mon Sep 17 00:00:00 2001 From: kouhe3 <25522053+kouhe3@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:11:31 +0800 Subject: lldbdap env dict to string --- src/tools/rust-analyzer/editors/code/src/debug.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/tools/rust-analyzer/editors/code') diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 8ccc80b2be1..933a8c56b21 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -230,7 +230,7 @@ const knownEngines: { "llvm-vs-code-extensions.lldb-dap":{ type: "lldb-dap", executableProperty: "program", - environmentProperty: (env) => ["env", env], + environmentProperty: (env) => ["env", Object.entries(env).map(([k,v])=>`${k}=${v}`)], runnableArgsProperty: (runnableArgs: ra.CargoRunnableArgs) => [ "args", runnableArgs.executableArgs, @@ -352,7 +352,8 @@ type CCppDebugConfig = { type LldbDapDebugConfig = { program: string; args: string[]; - env: Record; + env: string[]; + sourceMap: [string,string][]; } & BaseDebugConfig<"lldb-dap">; -- cgit 1.4.1-3-g733a5 From 63b0e270fbeedd34b073cc668977f8fea4d3378b Mon Sep 17 00:00:00 2001 From: kouhe3 <25522053+kouhe3@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:41:20 +0800 Subject: fix array sourceMap --- src/tools/rust-analyzer/editors/code/src/debug.ts | 28 +++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'src/tools/rust-analyzer/editors/code') diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 933a8c56b21..8966bdf36db 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -6,6 +6,7 @@ import type * as ra from "./lsp_ext"; import { Cargo } from "./toolchain"; import type { Ctx } from "./ctx"; import { createTaskFromRunnable, prepareEnv } from "./run"; +import { execSync } from 'node:child_process' import { execute, isCargoRunnableArgs, unwrapUndefinable } from "./util"; import type { Config } from "./config"; @@ -109,9 +110,9 @@ async function getDebugConfiguration( await vscode.window.showErrorMessage( `Install [CodeLLDB](command:${commandCodeLLDB} "Open CodeLLDB")` + - `, [lldb-dap](command:${commandLLDBDap} "Open lldb-dap")` + - `, [C/C++](command:${commandCCpp} "Open C/C++") ` + - `or [Native Debug](command:${commandNativeDebug} "Open Native Debug") for debugging.`, + `, [lldb-dap](command:${commandLLDBDap} "Open lldb-dap")` + + `, [C/C++](command:${commandCCpp} "Open C/C++") ` + + `or [Native Debug](command:${commandNativeDebug} "Open Native Debug") for debugging.`, ); return; } @@ -129,7 +130,7 @@ async function getDebugConfiguration( !isMultiFolderWorkspace || !runnableArgs.workspaceRoot ? firstWorkspace : workspaceFolders.find((w) => runnableArgs.workspaceRoot?.includes(w.uri.fsPath)) || - firstWorkspace; + firstWorkspace; const workspace = unwrapUndefinable(maybeWorkspace); let wsFolder = path.normalize(workspace.uri.fsPath); @@ -227,16 +228,25 @@ const knownEngines: { "ms-vscode.cpptools": DebugConfigProvider<"cppvsdbg" | "cppdbg", CCppDebugConfig>; "webfreak.debug": DebugConfigProvider<"gdb", NativeDebugConfig>; } = { - "llvm-vs-code-extensions.lldb-dap":{ + "llvm-vs-code-extensions.lldb-dap": { type: "lldb-dap", 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) => [ "args", 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": { type: "lldb", executableProperty: "program", @@ -353,7 +363,7 @@ type LldbDapDebugConfig = { program: string; args: string[]; env: string[]; - sourceMap: [string,string][]; + sourceMap: [string, string][]; } & BaseDebugConfig<"lldb-dap">; -- cgit 1.4.1-3-g733a5 From 3918e29facdff489f0fc259b42bad061aefd22dd Mon Sep 17 00:00:00 2001 From: kouhe3 <25522053+kouhe3@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:47:54 +0800 Subject: semicolon --- src/tools/rust-analyzer/editors/code/src/debug.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/tools/rust-analyzer/editors/code') diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 8966bdf36db..0114edf6890 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -6,7 +6,7 @@ import type * as ra from "./lsp_ext"; import { Cargo } from "./toolchain"; import type { Ctx } from "./ctx"; import { createTaskFromRunnable, prepareEnv } from "./run"; -import { execSync } from 'node:child_process' +import { execSync } from 'node:child_process'; import { execute, isCargoRunnableArgs, unwrapUndefinable } from "./util"; import type { Config } from "./config"; -- cgit 1.4.1-3-g733a5 From a2304baaf2608c08d473f6bb60b743108157c728 Mon Sep 17 00:00:00 2001 From: kouhe3 <25522053+kouhe3@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:50:29 +0800 Subject: prettier format --- src/tools/rust-analyzer/editors/code/src/debug.ts | 27 +++++++++++------------ 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'src/tools/rust-analyzer/editors/code') diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 0114edf6890..77ab44f24ce 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -6,7 +6,7 @@ import type * as ra from "./lsp_ext"; import { Cargo } from "./toolchain"; import type { Ctx } from "./ctx"; import { createTaskFromRunnable, prepareEnv } from "./run"; -import { execSync } from 'node:child_process'; +import { execSync } from "node:child_process"; import { execute, isCargoRunnableArgs, unwrapUndefinable } from "./util"; import type { Config } from "./config"; @@ -110,9 +110,9 @@ async function getDebugConfiguration( await vscode.window.showErrorMessage( `Install [CodeLLDB](command:${commandCodeLLDB} "Open CodeLLDB")` + - `, [lldb-dap](command:${commandLLDBDap} "Open lldb-dap")` + - `, [C/C++](command:${commandCCpp} "Open C/C++") ` + - `or [Native Debug](command:${commandNativeDebug} "Open Native Debug") for debugging.`, + `, [lldb-dap](command:${commandLLDBDap} "Open lldb-dap")` + + `, [C/C++](command:${commandCCpp} "Open C/C++") ` + + `or [Native Debug](command:${commandNativeDebug} "Open Native Debug") for debugging.`, ); return; } @@ -130,7 +130,7 @@ async function getDebugConfiguration( !isMultiFolderWorkspace || !runnableArgs.workspaceRoot ? firstWorkspace : workspaceFolders.find((w) => runnableArgs.workspaceRoot?.includes(w.uri.fsPath)) || - firstWorkspace; + firstWorkspace; const workspace = unwrapUndefinable(maybeWorkspace); let wsFolder = path.normalize(workspace.uri.fsPath); @@ -237,15 +237,15 @@ const knownEngines: { runnableArgs.executableArgs, ], additional: { - "sourceMap": [ + sourceMap: [ [ - `/rustc/${/commit-hash:\s(.*)$/m.exec(execSync("rustc -V -v", {}).toString())?.[1] - }/library`, - "${config:rust-analyzer.cargo.sysroot}/lib/rustlib/src/rust/library" - - ] - ] - } + `/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": { type: "lldb", @@ -366,7 +366,6 @@ type LldbDapDebugConfig = { sourceMap: [string, string][]; } & BaseDebugConfig<"lldb-dap">; - type CodeLldbDebugConfig = { program: string; args: string[]; -- cgit 1.4.1-3-g733a5