From 42c486d19615f39993b4dc5df8b4f92c622ea16a Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Mon, 16 Feb 2026 16:56:36 +0100 Subject: [PATCH] nvim/lua/user/plugins/ide/debugger.lua: move php stuff to its own file --- nvim/lua/user/plugins/ide/debugger.lua | 41 +++++--------------------- nvim/lua/user/plugins/lang/php/dap.lua | 37 +++++++++++++++++++++++ 2 files changed, 45 insertions(+), 33 deletions(-) create mode 100644 nvim/lua/user/plugins/lang/php/dap.lua diff --git a/nvim/lua/user/plugins/ide/debugger.lua b/nvim/lua/user/plugins/ide/debugger.lua index 5e0f2f3..913705e 100644 --- a/nvim/lua/user/plugins/ide/debugger.lua +++ b/nvim/lua/user/plugins/ide/debugger.lua @@ -2,14 +2,10 @@ return { { "mfussenegger/nvim-dap", dependencies = { - { - "rcarriga/nvim-dap-ui", - dependencies = { - "nvim-neotest/nvim-nio" - } - } + "rcarriga/nvim-dap-ui", }, - config = function () + opts = {}, + config = function (_, opts) local icons = require('user.icons') local dap = require('dap') local dapui = require("dapui") @@ -37,36 +33,15 @@ return { dapui.close() end - dap.adapters.php = { - type = 'executable', - command = 'node', - args = { '/home/pnx/vscode-php-debug/out/phpDebug.js' } - } - - dap.configurations.php = { - { - name = "PHP: Listen for Xdebug", - port = 9003, - request = "launch", - type = "php", - breakpoints = { - exception = { - Notice = false, - Warning = false, - Error = false, - Exception = false, - ["*"] = false, - }, - }, - pathMappings = { - ["/app"] = "${workspaceFolder}" - } - }, - } + for name, config in pairs(opts) do + dap.adapters[name] = config.adapter or {} + dap.configurations[name] = config.configurations or {} + end end }, { "rcarriga/nvim-dap-ui", + optional = true, dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" diff --git a/nvim/lua/user/plugins/lang/php/dap.lua b/nvim/lua/user/plugins/lang/php/dap.lua new file mode 100644 index 0000000..172bc61 --- /dev/null +++ b/nvim/lua/user/plugins/lang/php/dap.lua @@ -0,0 +1,37 @@ +local mason = require('user.utils.mason') + +return { + mason.ensure_installed('php-debug-adapter'), + { + "mfussenegger/nvim-dap", + optional = true, + opts = { + php = { + adapter = { + type = 'executable', + command = mason.binary('php-debug-adapter'), + }, + configurations = { + { + name = "PHP: Listen for Xdebug", + port = 9003, + request = "launch", + type = "php", + breakpoints = { + exception = { + Notice = false, + Warning = false, + Error = false, + Exception = false, + ["*"] = false, + }, + }, + pathMappings = { + ["/app"] = "${workspaceFolder}" + } + } + } + } + } + }, +}