93 lines
3.0 KiB
Lua
93 lines
3.0 KiB
Lua
return {
|
|
{
|
|
"folke/which-key.nvim",
|
|
optional = true,
|
|
opts = {
|
|
defaults = {
|
|
["<leader>t"] = { name = "+test" },
|
|
},
|
|
},
|
|
},
|
|
{
|
|
"nvim-neotest/neotest",
|
|
opts = {
|
|
-- Can be a list of adapters like what neotest expects,
|
|
-- or a list of adapter names,
|
|
-- or a table of adapter names, mapped to adapter configs.
|
|
-- The adapter will then be automatically loaded with the config.
|
|
adapters = {},
|
|
-- Example for loading neotest-go with a custom config
|
|
-- adapters = {
|
|
-- ["neotest-go"] = {
|
|
-- args = { "-tags=integration" },
|
|
-- },
|
|
-- },
|
|
quickfix = {
|
|
open = function()
|
|
if require("lazyvim.util").has("trouble.nvim") then
|
|
vim.cmd("Trouble quickfix")
|
|
else
|
|
vim.cmd("copen")
|
|
end
|
|
end,
|
|
},
|
|
},
|
|
config = function(_, opts)
|
|
local neotest_ns = vim.api.nvim_create_namespace("neotest")
|
|
vim.diagnostic.config({
|
|
virtual_text = {
|
|
format = function(diagnostic)
|
|
-- Replace newline and tab characters with space for more compact diagnostics
|
|
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
|
|
return message
|
|
end,
|
|
},
|
|
}, neotest_ns)
|
|
|
|
if opts.adapters then
|
|
local adapters = {}
|
|
for name, config in pairs(opts.adapters or {}) do
|
|
if type(name) == "number" then
|
|
if type(config) == "string" then
|
|
config = require(config)
|
|
end
|
|
adapters[#adapters + 1] = config
|
|
elseif config ~= false then
|
|
local adapter = require(name)
|
|
if type(config) == "table" and not vim.tbl_isempty(config) then
|
|
if adapter.setup then
|
|
adapter.setup(config)
|
|
elseif adapter.__call then
|
|
adapter(config)
|
|
else
|
|
error("Adapter " .. name .. " does not support setup")
|
|
end
|
|
end
|
|
adapters[#adapters + 1] = adapter
|
|
end
|
|
end
|
|
opts.adapters = adapters
|
|
end
|
|
|
|
require("neotest").setup(opts)
|
|
end,
|
|
-- stylua: ignore
|
|
keys = {
|
|
{ "<leader>tr", function() require("neotest").run.run() end, desc = "Run Nearest" },
|
|
{ "<leader>tR", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "Run File" },
|
|
{ "<leader>ts", function() require("neotest").summary.toggle() end, desc = "Toggle Summary" },
|
|
{ "<leader>to", function() require("neotest").output.open({ enter = true, auto_close = true }) end, desc = "Show Output" },
|
|
{ "<leader>tO", function() require("neotest").output_panel.toggle() end, desc = "Toggle Output Panel" },
|
|
{ "<leader>tS", function() require("neotest").run.stop() end, desc = "Stop" },
|
|
},
|
|
},
|
|
{
|
|
"mfussenegger/nvim-dap",
|
|
optional = true,
|
|
-- stylua: ignore
|
|
keys = {
|
|
{ "<leader>td", function() require("neotest").run.run({strategy = "dap"}) end, desc = "Debug Nearest" },
|
|
},
|
|
},
|
|
}
|