diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-02-02 19:05:36 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2022-02-02 19:06:47 +0100 |
| commit | 29b4a8f395845e4a9f86b48dee672166d25c3a58 (patch) | |
| tree | d878009efeb18424b088f99e1d79a96d8b67600e /lua/alpha/dap.lua | |
| parent | af68fdb99fd4107ceae0f22c80e3820a1f94b697 (diff) | |
| download | nvim-conf-29b4a8f395845e4a9f86b48dee672166d25c3a58.tar.gz nvim-conf-29b4a8f395845e4a9f86b48dee672166d25c3a58.zip | |
improve dap, re add max window, update plugins
Diffstat (limited to 'lua/alpha/dap.lua')
| -rw-r--r-- | lua/alpha/dap.lua | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/lua/alpha/dap.lua b/lua/alpha/dap.lua index dfa7110..9d94afa 100644 --- a/lua/alpha/dap.lua +++ b/lua/alpha/dap.lua @@ -1,32 +1,31 @@ -local dap = require('dap') +local dap, dapui, dap_install = require("dap"), require("dapui"), require("dap-install") local api = vim.api -dap.adapters.php = { - type = 'executable', - command = 'node', - args = { os.getenv('HOME') .. '/repos/vscode-php-debug/out/phpDebug.js' } -} +dapui.setup() -dap.configurations.php = { - { - type = 'php', - request = 'launch', - name = 'Listen for Xdebug', - port = 9003, - pathMappings = { - ['/var/www/html'] = vim.fn.getcwd(), - ['/app'] = vim.fn.getcwd(), +dap_install.config("php", { + configurations = { + { + type = 'php', + request = 'launch', + name = 'Listen for Xdebug', + port = 9003, + pathMappings = function () + local sail = vim.call('composer#query', 'require-dev.laravel/sail') + if sail == nil then + return {['/app'] = vim.fn.getcwd()} + end + return {['/var/www/html'] = vim.fn.getcwd()} + end + } } - } -} - +}) -- Events Listeners -dap.listeners.before['event_terminated']['alpha'] = function(session, body) - print('Session terminated', vim.inspect(session), vim.inspect(body)) +dap.listeners.after.event_initialized["dapui_config"] = function() + dapui.open() end - local function with_win(win, fn, ...) local cur_win = api.nvim_get_current_win() api.nvim_set_current_win(win) @@ -71,7 +70,6 @@ end dap.listeners.after['event_stopped']['alpha'] = function(session, body) - P(body.reason) if body.reason ~= 'breakpoint' then return end @@ -89,6 +87,7 @@ end vim.api.nvim_set_keymap('n', '<leader>dbp', ':lua require\'dap\'.toggle_breakpoint()<cr>', {noremap = true}) vim.api.nvim_set_keymap('n', '<leader>dd', ':lua require\'dap\'.continue()<cr>', {noremap = true}) +vim.api.nvim_set_keymap('n', '<leader>de', ':lua require\'alpha.dap-fn\'.stop()<cr>', {noremap = true}) vim.api.nvim_set_keymap('n', '<leader>dl', ':lua require\'dap\'.step_into()<cr>', {noremap = true}) vim.api.nvim_set_keymap('n', '<leader>dj', ':lua require\'dap\'.step_over()<cr>', {noremap = true}) vim.api.nvim_set_keymap('n', '<leader>dk', ':lua require\'dap\'.step_out()<cr>', {noremap = true}) |