-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debugger: add support for nvim-dap & codelldb
- Loading branch information
1 parent
7888bab
commit dfd6c3a
Showing
6 changed files
with
104 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
config, | ||
lib, | ||
pkgs, | ||
... | ||
}: | ||
with lib; | ||
with builtins; let | ||
cfg = config.vim.debugger; | ||
in { | ||
options.vim.debugger = { | ||
enable = mkEnableOption "LSP, also enabled automatically through null-ls and lspconfig options"; | ||
|
||
port = mkOption { | ||
description = "Port to start the debugger on"; | ||
type = types.int; | ||
default = 13000; | ||
}; | ||
|
||
enrichConfig = mkOption { | ||
description = "Lua script that enriches the config"; | ||
type = types.lines; | ||
default = ""; | ||
example = nvim.nmd.literalAsciiDoc '' | ||
[source,lua] | ||
--- | ||
if config["cargo"] ~= nil then on_config(cargo_inspector(config)) end | ||
--- | ||
''; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
vim.startPlugins = ["nvim-dap"]; | ||
|
||
vim.autocomplete.sources = {"nvim_lsp" = "[LSP]";}; | ||
|
||
vim.luaConfigRC.dap-setup = '' | ||
local dap = require('dap') | ||
local codelldb_bin = "${pkgs.code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb" | ||
local codelldb_lib = "${pkgs.code-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/lldb/lib/liblldb.dylib" | ||
local port = "${port}", | ||
dap.adapters.codelldb = { | ||
type = 'server', | ||
port = "${port}", | ||
executable = { | ||
command = codelldb_bin, | ||
args = {"--liblldb", codelldb_lib, "--port", "${port}"}, | ||
enrich_config = function(config, on_config) | ||
${enrichConfig} | ||
end, | ||
} | ||
} | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
./telescope | ||
./git | ||
./build | ||
./debugger | ||
]; | ||
|
||
pkgsModule = {config, ...}: { | ||
|