Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Use with dap.ext.vscode launch.json

Steven Huang edited this page Apr 28, 2023 · 5 revisions

Overview

nvim-dap supports loading VSCode style launch.json with require('dap.ext.vscode').load_launchjs().

However since rust-tools internally defines the adapter as rt_lldb and the default dap.ext.vscode behaviour is to map names of configuration types to adapter types (rust configurations to rust adapters), we get below error if we try to use the rt_lldb adapter in our launch.json:

No configuration found for `rust`. You need to add configs to `dap.configurations.rust` (See `:h dap-configuration`)

Fortunately load_launchjs provides an override mapping to change this behaviour.

Update your configuration to pass in the table {rt_lldb={'rust'} in 2nd arg.

See :help dap.ext.vscode.load_launchjs for more details.

-- a nil path defaults to .vscode/launch.json
require('dap.ext.vscode').load_launchjs(nil, {rt_lldb={'rust'}})

Here's a sample .vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "rt_lldb",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/target/debug/${workspaceFolderBasename}",
            "stopAtEntry": true
        }
    ]
}

Now require 'dap'.continue will open the debugger as you expect it should.

Clone this wiki locally