codelldb icon indicating copy to clipboard operation
codelldb copied to clipboard

Need to support the TOML config file format for Rust launch configurations

Open scottyancey opened this issue 5 months ago • 0 comments

I add the path to my config.toml file (which is Rust's standard for configuration files) in a launch.json configuration's envFile parameter:

"envFile": "${workspaceFolder}/.cargo/config.toml",

But when I execute the debugger it returns with an error in a dialog box saying:

Internal debugger error: Error parsing line: '[env]', error at line index: 0

It seems like lldb can't handle the TOML table syntax of [env] which is what Rust config files must include to declare the section for environment variables. And without the [env] table header in that config.toml file then Cargo won't load those variables into the application runtime (which are needed by the program to run properly).

Here's the complete syntax...

launch.json configuration:

`{
            "type": "lldb",
            "request": "launch",
            "name": "Debug executable 'cargo run'",
            "cargo": {
                "args": [
                    "build",
                    "--bin=rust_react_app_hello_world",
                    "--package=rust_react_app_hello_world"
                ],
                "filter": {
                    "name": "rust_react_app_hello_world",
                    "kind": "bin"
                }
            },
            "envFile": "${workspaceFolder}/.cargo/config.toml",
            "args": [],
            "cwd": "${workspaceFolder}"
        }`


And here's the beginning snippet of the config.toml file:

[env]

# app server
app_server_url= "127.0.0.1:3000"
app_server_graceful_shutdown_max_duration="10" # In seconds
...


scottyancey avatar Sep 13 '24 03:09 scottyancey