diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-08-19 08:43:20 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-08-19 08:43:20 +0200 |
| commit | 609852c739ef90f090f7084f029e6bb82f4c9501 (patch) | |
| tree | 5d9d71f7365cf81acdeb603c3d436b380cc077fd /lua/alpha/dap.lua | |
| parent | c681cadf8cfdf37d28f85b0667e67ae374563f91 (diff) | |
| download | nvim-conf-609852c739ef90f090f7084f029e6bb82f4c9501.tar.gz nvim-conf-609852c739ef90f090f7084f029e6bb82f4c9501.zip | |
fix emoji list, improve dap config
Diffstat (limited to 'lua/alpha/dap.lua')
| -rw-r--r-- | lua/alpha/dap.lua | 179 |
1 files changed, 99 insertions, 80 deletions
diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua index f6dc44e..09824bd 100644 --- a/lua/alpha/dap.lua +++ b/lua/alpha/dap.lua @@ -4,55 +4,62 @@ require("nvim-dap-virtual-text").setup({}) -- dap.set_log_level('TRACE') dapui.setup({ - icons = { expanded = "▾", collapsed = "▸" }, - layouts = { - { - elements = { - "scopes", - "breakpoints", - "stacks", - "watches", - }, size = 80, - position = "left", - }, - { - elements = { - "repl", - -- 'console', - }, - size = 5, - position = "bottom", - }, - }, + icons = { expanded = "▾", collapsed = "▸" }, + layouts = { + { + elements = { + "scopes", + "breakpoints", + "stacks", + "watches", + }, + size = 80, + position = "left", + }, + { + elements = { + "repl", + -- 'console', + }, + size = 10, + position = "bottom", + }, + }, }) dap_go.setup() -vim.fn.sign_define("DapBreakpoint", { text = "ß", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapStopped", { text = "⏯️", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpointRejected", { text = "🚫", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapBreakpointCondition", { text = "❓", texthl = "", linehl = "", numhl = "" }) +vim.fn.sign_define("DapLogPoint", { text = "💬", texthl = "", linehl = "", numhl = "" }) + +vim.cmd("au FileType dap-repl lua require('dap.ext.autocompl').attach()") -- TODO replace with mason for check if installed and get the path -- the binary does not work local php_debug_adapter = vim.fn.stdpath("data") .. "/mason/packages/php-debug-adapter/extension/out/phpDebug.js" dap.adapters.php = { - type = "executable", - command = "node", - args = { php_debug_adapter }, + type = "executable", + command = "node", + args = { php_debug_adapter }, } dap.configurations.php = { - { - type = "php", - request = "launch", - name = "Listen for Xdebug", - port = 9003, - pathMappings = function() - local sail = vim.call("composer#query", "require-dev.laravel/sail") - if sail == "" then - return { ["/app"] = vim.fn.getcwd() } - end - return { ["/var/www/html"] = vim.fn.getcwd() } - end, - }, + { + type = "php", + request = "launch", + name = "Listen for Xdebug", + port = 9003, + pathMappings = function() + local sail = vim.call("composer#query", "require-dev.laravel/sail") + if sail == "" then + return { ["/app"] = vim.fn.getcwd() } + end + return { ["/var/www/html"] = vim.fn.getcwd() } + end, + }, } -- Events Listeners @@ -66,52 +73,64 @@ local hint = [[ _d_: Start/Continue _j_: StepOver _k_: StepOut _l_: StepInto ^ _bp_: Toogle Breakpoint _bc_: Conditional Breakpoint ^ _c_: Run To Cursor _tt_: Go Debug Test + _h_: Show information of the variable under the cursor _?_ log point _s_: Start _x_: Stop Debbuging ^^ _<Esc>_ ]] hydra({ - name = "dap", - hint = hint, - mode = "n", - config = { - color = "blue", - invoke_on_body = true, - hint = { - border = "rounded", - position = "bottom", - }, - }, - body = "<leader>d", - heads = { - { "d", dap.continue }, - { "s", function () - dap.continue() - dapui.open({}) - end }, - { "bp", dap.toggle_breakpoint }, - { "l", dap.step_into }, - { "j", dap.step_over }, - { "k", dap.step_out }, - { "c", dap.run_to_cursor }, - { "tt", dap_go.debug_test }, - { - "bc", - function() - vim.ui.input({ prompt = "Condition: " }, function(condition) - dap.toggle_breakpoint(condition) - end) - end, - }, - - { - "x", - function() - dap.terminate() - dapui.close({}) - dap.clear_breakpoints() - end, - }, + name = "dap", + hint = hint, + mode = "n", + config = { + color = "blue", + invoke_on_body = true, + hint = { + border = "rounded", + position = "bottom", + }, + }, + body = "<leader>d", + heads = { + { "d", dap.continue }, + { + "s", + function() + dap.continue() + dapui.open({}) + end, + }, + { "bp", dap.toggle_breakpoint }, + { "l", dap.step_into }, + { "j", dap.step_over }, + { "k", dap.step_out }, + { "h", dapui.eval }, + { "c", dap.run_to_cursor }, + { "tt", dap_go.debug_test }, + { + "bc", + function() + vim.ui.input({ prompt = "Condition: " }, function(condition) + dap.set_breakpoint(condition) + end) + end, + }, + { + "?", + function () + vim.ui.input({ prompt = "Log: " }, function(log) + dap.set_breakpoint(nil, nil, log) + end) + end + }, + { + "x", + function() + dap.terminate() + dapui.close({}) + dap.clear_breakpoints() + end, + }, - { "<Esc>", nil, { exit = true } }, - }, + { "<Esc>", nil, { exit = true } }, + }, }) |