1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-23 16:06:48 +00:00
dotfiles/.config/nvim/lua/plugins/neotest.lua

44 lines
1013 B
Lua
Raw Normal View History

2024-02-03 15:22:54 +00:00
local neotest_ns = vim.api.nvim_create_namespace("neotest")
2024-02-03 15:22:54 +00:00
vim.diagnostic.config({
virtual_text = {
format = function(diagnostic)
local message = diagnostic.message:gsub("\n", " "):gsub("\t", " "):gsub("%s+", " "):gsub("^%s+", "")
return message
end,
},
}, neotest_ns)
vim.api.nvim_create_user_command("CopyDirectoryPath", function()
local path = vim.fn.expand("%:p:h")
vim.fn.setreg("+", path)
vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {})
local neotest = require("neotest")
neotest.setup({
2024-02-03 15:22:54 +00:00
adapters = {
require("neotest-go")({
recursive_run = true,
experimental = {
test_table = true,
},
args = { "-count=1" },
}),
require("neotest-python")({}),
2024-02-03 15:22:54 +00:00
},
})
vim.api.nvim_create_user_command("RunTest", function()
2024-02-12 19:46:40 +00:00
neotest.run.run()
end, {})
2024-06-08 14:43:07 +00:00
vim.api.nvim_create_user_command("DebugTest", function()
neotest.run.run({ strategy = "dap" })
end, {})
vim.api.nvim_create_user_command("RunTestFile", function()
2024-02-12 19:46:40 +00:00
neotest.run.run(vim.fn.expand("%"))
end, {})