You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just saw that there is now a plugin for nixvimdap called dap-lldb, which should make it easier to setup debug configurations for C/C++/Rust.
My setup so far looked something like this:
{config,lib,pkgs, ...
}:
letcodelldb-config={name="Launch (CodeLLDB)";type="codelldb";request="launch";program.__raw='' function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. '/', "file") end '';cwd=''''${workspaceFolder}'';stopOnEntry=false;};lldb-config={name="Launch (LLDB)";type="lldb";request="launch";program.__raw='' function() return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. '/', "file") end'';cwd=''''${workspaceFolder}'';stopOnEntry=false;};in{extraPackages=withpkgs;[coreutilslldb_18];plugins={dap={enable=true;adapters={executables={lldb={command=lib.getExe'pkgs.lldb"lldb-vscode";};};servers={codelldb={port=13000;executable={command="${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";args=["--port""13000"];};};};};configurations={c=[lldb-config];cpp=[lldb-config]++lib.optionalspkgs.stdenv.isLinux[codelldb-config];rust=[lldb-config]++lib.optionalspkgs.stdenv.isLinux[codelldb-config];};extensions={dap-ui={enable=true;};dap-virtual-text={enable=false;};};};}
This worked okey-ish, but was a bit cumbersome. So the idea was to switch now to this plugging which hopefully should make this easier. The documentation can be found here and I guess the interesting part is also this subpage.
To be honest, Im not entirely sure how to use this plugin correctly… I tried the following:
{config,lib,pkgs, ...
}:
{extraPackages=withpkgs;[coreutilslldb_18];plugins={dap={enable=true;adapters={executables={lldb={command=lib.getExe'pkgs.lldb"lldb-vscode";};};servers={codelldb={port=13000;executable={command="${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb";args=["--port""13000"];};};};};configurations={};extensions={dap-ui={enable=true;};dap-virtual-text={enable=false;};};};dap-lldb={enable=true;settings.configurations={rust=[{cwd="$\${workspaceFolder}";name="Debug";program={__raw='' function(selection) local targets = list_targets(selection) if targets == nil then return nil end if #targets == 0 then return read_target() end if #targets == 1 then return targets[1] end local options = { "Select a target:" } for index, target in ipairs(targets) do local parts = vim.split(target, sep, { trimempty = true }) local option = string.format("%d. %s", index, parts[#parts]) table.insert(options, option) end local choice = vim.fn.inputlist(options) return targets[choice] end '';};request="launch";stopOnEntry=false;type="lldb";}]}};};}
but:
This does not work. Trying to run a Rust application with the debugger results in a complaint that I need to register a dap.configurations.rust entry, and
This does not seem to be much more simple than writing in the original way…
So, in short, how would a correct example config look like for dap-lldb?
The text was updated successfully, but these errors were encountered:
Thanks for this detailed report.
Regarding the conciseness, it's quite normal that it remains large. Indeed, here we are thinly wrapping the plugin configuration options. This means that there is no real reason for the nixvim config to be shorter than its equivalent in lua.
I don't use dap myself, so I'm not sure that I can help there. However, you can start by checking the generated lua configuration using nixvim-print-init.
@GaetanLepage Sorry for the misunderstanding, I was not particularly clear in my second question: I think it makes total sense that the configuration in nix needs to mirror the code and options in lua. What is not clear to me is how dap-lldb is different to dap in general. I understood dap-lldb as a tool to make configuring lldb based debugging easier than with dap itself, but looking at the configuration examples in the docs, its not clear to me if it is...
Or, I'm of course just misunderstanding how it is intended to be used.
I just saw that there is now a plugin for
nixvim
dap
calleddap-lldb
, which should make it easier to setup debug configurations for C/C++/Rust.My setup so far looked something like this:
This worked okey-ish, but was a bit cumbersome. So the idea was to switch now to this plugging which hopefully should make this easier. The documentation can be found here and I guess the interesting part is also this subpage.
To be honest, Im not entirely sure how to use this plugin correctly… I tried the following:
but:
So, in short, how would a correct example config look like for
dap-lldb
?The text was updated successfully, but these errors were encountered: