From 8618b74356e3ab036967639e580df5b93005d4ae Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Tue, 25 Jan 2022 18:22:31 +0100 Subject: WIP migrating from vimspector to dap --- lua/alpha/init.lua | 20 ++++++++++++++++++++ lua/alpha/scratchs/dap.lua | 44 ++++++++++++++++++++++++++++++++++++++++++++ lua/plugins.lua | 8 ++------ 3 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 lua/alpha/scratchs/dap.lua (limited to 'lua') diff --git a/lua/alpha/init.lua b/lua/alpha/init.lua index 9b50ae2..296b38c 100644 --- a/lua/alpha/init.lua +++ b/lua/alpha/init.lua @@ -16,3 +16,23 @@ vim.api.nvim_set_keymap('n', 'rs', ':lua require(\'alpha.refactor\').set vim.api.nvim_set_keymap('n', 'rn', ':lua require(\'alpha.refactor\').new_property()', {noremap = true}) vim.api.nvim_set_keymap('n', 'x', ':call alpha#save_and_exec()', {noremap = true}) + +local dap = require('dap') + +dap.adapters.php = { + type = 'executable', + command = 'node', + args = { '/home/adalessa/repos/vscode-php-debug/out/phpDebug.js' } +} + +dap.configurations.php = { + { + type = 'php', + request = 'launch', + name = 'Listen for Xdebug', + port = 9003, + pathMappings = { + ['/app'] = vim.fn.getcwd() + } + } +} diff --git a/lua/alpha/scratchs/dap.lua b/lua/alpha/scratchs/dap.lua new file mode 100644 index 0000000..0434449 --- /dev/null +++ b/lua/alpha/scratchs/dap.lua @@ -0,0 +1,44 @@ +-- What is require to improve the debug +-- A single configuration, dinamicaly generate when start the debugging +-- keybinding to add breakpoint +-- continue +-- step over +-- step into +-- step out +-- +-- +-- nnoremap :lua require'dap'.continue() +-- nnoremap :lua require'dap'.step_over() +-- nnoremap :lua require'dap'.step_into() +-- nnoremap :lua require'dap'.step_out() +-- nnoremap b :lua require'dap'.toggle_breakpoint() +-- nnoremap B :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: ')) +-- nnoremap lp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) +-- nnoremap dr :lua require'dap'.repl.open() +-- nnoremap dl :lua require'dap'.run_last() +-- help mapping +-- my idea is to have a function to generate the path of the configuration +-- +-- +-- local dap = require('dap') + +-- dap.adapters.php = { +-- type = 'executable', +-- command = 'node', +-- args = { '/home/adalessa/repos/vscode-php-debug/out/phpDebug.js' } +-- } + +-- dap.configurations.php = { +-- { +-- type = 'php', +-- request = 'launch', +-- name = 'Listen for Xdebug', +-- port = 9003, +-- pathMappings = { +-- ['/app'] = '/home/adalessa/code/php/carin-gateway-service' +-- } +-- } +-- } +-- the problem is the path mapping maybe just have that updated by project base +-- maybe have it as a resolve function of the path when open, need to test + require('dap.ui.widgets').hover() diff --git a/lua/plugins.lua b/lua/plugins.lua index 0b49f4b..2dd2414 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -65,12 +65,8 @@ return require('packer').startup(function(use) requires = {'kyazdani42/nvim-web-devicons', opt = true} } - use { - 'puremourning/vimspector', - requires = { - { 'mfussenegger/nvim-dap' } - }, - } + use 'puremourning/vimspector' + use 'mfussenegger/nvim-dap' use 'szw/vim-maximizer' -- cgit v1.2.3