diff options
| -rw-r--r-- | after/plugin/neotest.lua | 64 | ||||
| -rw-r--r-- | lua/alpha/plugins.lua | 2 | ||||
| -rw-r--r-- | queries/php/injections.scm | 6 |
3 files changed, 48 insertions, 24 deletions
diff --git a/after/plugin/neotest.lua b/after/plugin/neotest.lua index 583084a..c43e74c 100644 --- a/after/plugin/neotest.lua +++ b/after/plugin/neotest.lua @@ -1,17 +1,33 @@ local ok, neotest = pcall(require, "neotest") if not ok then - return + return end +local composer = require("composer") + neotest.setup({ - adapters = { - require("neotest-go"), - require("neotest-rust"), - require("neotest-plenary"), - require("neotest-vim-test")({ - ignore_file_types = { "go", "lua", "rust" }, - }), - }, + adapters = { + require("neotest-go"), + require("neotest-rust"), + require("neotest-plenary"), + require("neotest-vim-test")({ + ignore_file_types = { "go", "lua", "rust", "php" }, + }), + require("neotest-phpunit")({ + phpunit_cmd = function() + if composer.query({ "require-dev", "laravel/sail" }) ~= nil then + return { "vendor/bin/sail", "phpunit" } + end + return "vendor/bin/phpunit" + end, + path_mapping = function () + if composer.query({"require-dev", "laravel/sali"}) ~= nil then + return { ["/app"] = vim.fn.getcwd() } + end + return { ["/var/www/html"] = vim.fn.getcwd() } + end + }), + }, }) local hydra = require("hydra") @@ -23,27 +39,27 @@ local hint = [[ ]] hydra({ - name = "neotest", + name = "neotest", hint = hint, - mode = "n", + mode = "n", config = { color = "teal", invoke_on_body = true, hint = { border = "rounded", position = "bottom", - } + }, + }, + body = "<C-t>", + heads = { + { "n", neotest.run.run }, + { + "f", + function() + neotest.run.run(vim.fn.expand("%")) + end, + }, + { "s", neotest.summary.toggle }, + { "<Esc>", nil, { exit = true } }, }, - body = "<C-t>", - heads = { - { "n", neotest.run.run }, - { - "f", - function() - neotest.run.run(vim.fn.expand("%")) - end, - }, - { "s", neotest.summary.toggle }, - { '<Esc>', nil, { exit = true } } - }, }) diff --git a/lua/alpha/plugins.lua b/lua/alpha/plugins.lua index e2025b2..223f23f 100644 --- a/lua/alpha/plugins.lua +++ b/lua/alpha/plugins.lua @@ -155,6 +155,7 @@ return require("packer").startup(function(use) "rouge8/neotest-rust", "nvim-neotest/neotest-plenary", "nvim-neotest/neotest-vim-test", + -- "olimorris/neotest-phpunit", }, }) @@ -216,6 +217,7 @@ return require("packer").startup(function(use) local_use("php-code-actions.nvim") local_use("laravel.nvim") local_use("composer.nvim") + local_use("neotest-phpunit") use("habamax/vim-godot") diff --git a/queries/php/injections.scm b/queries/php/injections.scm new file mode 100644 index 0000000..3f809f7 --- /dev/null +++ b/queries/php/injections.scm @@ -0,0 +1,6 @@ +(function_call_expression + ( + (name) @_function (#eq? @_function "json_decode") + (arguments (argument (string (string_value) @json ))) + ) +) |