diff --git a/lazy-lock.json b/lazy-lock.json index 04abdbe..ee7cdcb 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -27,7 +27,7 @@ "mini.indentscope": { "branch": "main", "commit": "f0d7faa064c892b96997810afcddfadc3f2a15b3" }, "neoscroll.nvim": { "branch": "master", "commit": "a731f66f1d39ec6175fd201c5bf849e54abda99c" }, "neotest": { "branch": "master", "commit": "f30bab1faef13d47f3905e065215c96a42d075ad" }, - "neotest-jest": { "branch": "main", "commit": "514fd4eae7da15fd409133086bb8e029b65ac43f" }, + "neotest-phpunit": { "branch": "main", "commit": "baae8dfa0a3aaacd9f0bb6845d6348f5bcdc48bb" }, "noice.nvim": { "branch": "main", "commit": "8f1d9966762e62fa8788e5fb1a5f6a86784221d9" }, "none-ls-extras.nvim": { "branch": "main", "commit": "336e84b9e43c0effb735b08798ffac382920053b" }, "none-ls.nvim": { "branch": "main", "commit": "f1b438ab1709cf9d8875843559d20265013ac755" }, @@ -37,7 +37,6 @@ "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-dap": { "branch": "master", "commit": "5ba8ceace596360321cf33fa4b56d9d46e057ce9" }, "nvim-dap-ui": { "branch": "master", "commit": "f7d75cca202b52a60c520ec7b1ec3414d6e77b0f" }, - "nvim-dap-vscode-js": { "branch": "main", "commit": "e7c05495934a658c8aa10afd995dacd796f76091" }, "nvim-lspconfig": { "branch": "master", "commit": "0b8165cf95806bc4bb8f745bb0c92021b2ed4b98" }, "nvim-material-icon": { "branch": "main", "commit": "2f1d6333bbec2e787774193c9fc7b447b878069a" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, @@ -62,7 +61,7 @@ "vim-startuptime": { "branch": "master", "commit": "97a88e688482a09c3c4b777d07b509b328a5ec29" }, "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 1b3163c..2dd1d11 100644 --- a/lua/custom/default.lua +++ b/lua/custom/default.lua @@ -148,13 +148,9 @@ pcode.rest_client = true -- https://github.com/mfussenegger/nvim-dap pcode.nvim_dap = false -- not support for windows os (auto config mason-nvim-dap) -pcode.nvim_dap_javascript = false -pcode.nvim_dap_php = false pcode.nvim_dap_python = false pcode.nvim_dap_go = false --- https://github.com/olimorris/neotest-phpunit -pcode.phpunit = false -- https://github.com/nvim-neotest/neotest-python -- https://docs.pytest.org/en/7.1.x/getting-started.html pcode.pytest = false @@ -163,7 +159,8 @@ pcode.gotest = false pcode.active_rust_config = false pcode.active_javascript_config = { - status = true, + status = false, jest_command = "npm test -- ", jest_config = "jest.config.mjs", } +pcode.active_php_config = true diff --git a/lua/plugins/dap_php.lua b/lua/plugins/dap_php.lua deleted file mode 100644 index 21c1396..0000000 --- a/lua/plugins/dap_php.lua +++ /dev/null @@ -1,80 +0,0 @@ -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 }, - { - "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 diff --git a/lua/plugins/phpcfg.lua b/lua/plugins/phpcfg.lua new file mode 100644 index 0000000..25c5e53 --- /dev/null +++ b/lua/plugins/phpcfg.lua @@ -0,0 +1,112 @@ +local M = {} +if pcode.active_php_config then + M = { + { + "rcarriga/nvim-dap-ui", + lazy = true, + event = "BufRead", + dependencies = { + { "mfussenegger/nvim-dap", lazy = true }, + { "nvim-neotest/nvim-nio", 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" }, + }, + }, + { + "nvim-neotest/neotest", + dependencies = { + "antoinemadec/FixCursorHold.nvim", + "olimorris/neotest-phpunit", + "nvim-neotest/nvim-nio", + }, + config = function() + require("neotest-phpunit")({ + filter_dirs = { "vendor" }, + }) + require("neotest").setup({ + adapters = { + require("neotest-phpunit"), + }, + }) + end, + -- stylua: ignore + keys = { + { "T","",desc="  Test"}, + { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, + { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, + { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, + { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, + { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, + { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, + { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, + { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, + }, + }, + } +end + +return M diff --git a/lua/plugins/test_php.lua b/lua/plugins/test_php.lua deleted file mode 100644 index b97adf3..0000000 --- a/lua/plugins/test_php.lua +++ /dev/null @@ -1,37 +0,0 @@ -local M = {} -if pcode.phpunit then - M = { - { - "nvim-neotest/neotest", - dependencies = { - "antoinemadec/FixCursorHold.nvim", - "olimorris/neotest-phpunit", - "nvim-neotest/nvim-nio", - }, - config = function() - require("neotest-phpunit")({ - filter_dirs = { "vendor" }, - }) - require("neotest").setup({ - adapters = { - require("neotest-phpunit"), - }, - }) - end, - -- stylua: ignore - keys = { - { "T","",desc="  Test"}, - { "Tt", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" }, - { "Tr", function() require("neotest").run.run() end, desc = "Run Nearest" }, - { "TT", function() require("neotest").run.run(vim.loop.cwd()) end, desc = "Run All Test Files" }, - { "Tl", function() require("neotest").run.run_last() end, desc = "Run Last" }, - { "Ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" }, - { "To", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" }, - { "TO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" }, - { "TS", function() require("neotest").run.stop() end, desc = "Stop" }, - }, - }, - } -end - -return M diff --git a/lua/plugins/themes/_globalvar.lua b/lua/plugins/themes/_globalvar.lua index becf10f..ebefa7e 100644 --- a/lua/plugins/themes/_globalvar.lua +++ b/lua/plugins/themes/_globalvar.lua @@ -42,4 +42,14 @@ if pcode.active_javascript_config.status then end table.insert(pcode.mason_ensure_installed, "tsserver") end +-- run if php config true +if pcode.active_php_config then + local lst_ts = { "php", "phpdoc" } + for _, ts in pairs(lst_ts) do + table.insert(pcode.treesitter_ensure_installed, ts) + end + table.insert(pcode.mason_ensure_installed, "intelephense") + table.insert(pcode.null_ls_ensure_installed, "phpcbf") + table.insert(pcode.null_ls_ensure_installed, "phpcs") +end return {}