diff --git a/lazy-lock.json b/lazy-lock.json index 797df45..944e6ca 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -33,6 +33,7 @@ "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" }, "nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "d7c695ea39542f6da94ee4d66176f5d660ab0a77" }, "nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" }, "nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" }, "nvim-material-icon": { "branch": "main", "commit": "7a8893417c6947925d00946d16b81b56574796a9" }, @@ -59,6 +60,7 @@ "vim-visual-multi": { "branch": "master", "commit": "b84a6d42c1c10678928b0bf8327f378c8bc8af5a" }, "virt-column.nvim": { "branch": "master", "commit": "b62b4ef0774d19452d4ed18e473e824c7a756f2f" }, "vscode-js-debug": { "branch": "main", "commit": "9fd0efd39d534304cffd970263148923b627be20" }, + "vscode-php-debug": { "branch": "main", "commit": "3025d1f01b5b7725e7c1c213d63f3de45f0534b3" }, "which-key.nvim": { "branch": "main", "commit": "0539da005b98b02cf730c1d9da82b8e8edb1c2d2" }, "yanky.nvim": { "branch": "main", "commit": "9268018e92d02650a94e39dd5f5903c542f7ea11" } } \ No newline at end of file diff --git a/lua/custom/default.lua b/lua/custom/default.lua index 93aa9b6..163e6ee 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -152,4 +152,5 @@ pcode.refactoring = false -- https://github.com/mfussenegger/nvim-dap pcode.nvim_dap = false -- not support for windows os -pcode.nvim_dap_javascript = true +pcode.nvim_dap_javascript = false +pcode.nvim_dap_php = false diff --git a/lua/plugins/dap_php.lua b/lua/plugins/dap_php.lua new file mode 100644 index 0000000..f7f9d84 --- /dev/null +++ b/lua/plugins/dap_php.lua @@ -0,0 +1,81 @@ +local M = {} +if pcode.nvim_dap_php then + M = { + "rcarriga/nvim-dap-ui", + lazy = true, + event = "BufRead", + dependencies = { + { "mfussenegger/nvim-dap", lazy = true }, + { "nvim-neotest/nvim-nio", lazy = true }, + { "theHamsta/nvim-dap-virtual-text", lazy = true }, + { + "xdebug/vscode-php-debug", + version = "1.x", + build = "npm install && npm run build", + config = function() + require("dap.ext.vscode").load_launchjs() + end, + }, + }, + config = function() + require("user.dapui") + local dap = require("dap") + dap.adapters.php = { + type = "executable", + command = "node", + -- change this to where you build vscode-php-debug + args = { vim.fn.stdpath("data") .. "/lazy/vscode-php-debug/out/phpDebug.js" }, + } + + dap.configurations.php = { + -- to run php right from the editor + { + name = "run current script", + type = "php", + request = "launch", + port = 9003, + cwd = "${fileDirname}", + program = "${file}", + runtimeExecutable = "php", + }, + -- to listen to any php call + { + name = "listen for Xdebug local", + type = "php", + request = "launch", + port = 9003, + }, + -- to listen to php call in docker container + { + name = "listen for Xdebug docker", + type = "php", + request = "launch", + port = 9003, + -- this is where your file is in the container + pathMappings = { + ["/opt/project"] = "${workspaceFolder}", + }, + }, + } + end, + keys = { + { "d", "", desc = "  Debug" }, + { "dt", "lua require'dap'.toggle_breakpoint()", desc = "Toggle Breakpoint" }, + { "db", "lua require'dap'.step_back()", desc = "Step Back" }, + { "dc", "lua require'dap'.continue()", desc = "Continue" }, + { "dC", "lua require'dap'.run_to_cursor()", desc = "Run To Cursor" }, + { "dd", "lua require'dap'.disconnect()", desc = "Disconnect" }, + { "dg", "lua require'dap'.session()", desc = "Get Session" }, + { "di", "lua require'dap'.step_into()", desc = "Step Into" }, + { "do", "lua require'dap'.step_over()", desc = "Step Over" }, + { "du", "lua require'dap'.step_out()", desc = "Step Out" }, + { "dp", "lua require'dap'.pause()", desc = "Pause" }, + { "dr", "lua require'dap'.repl.toggle()", desc = "Toggle Repl" }, + { "ds", "lua require'dap'.continue()", desc = "Start" }, + { "dq", "lua require'dap'.close()", desc = "Quit" }, + { "dU", "lua require'dapui'.toggle({reset = true})", desc = "Toggle UI" }, + }, + } +end + +return M