Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nvim): neotest improved diagnostics #151

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion nvim-fredrik/lua/plugins/neotest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,24 @@ return {
opts.adapters = adapters
end

require("neotest").setup(opts)
-- Get neotest namespace (api call creates or returns namespace). This is
-- optional but recommended if you enabled the diagnostic option of
-- neotest. Especially testify makes heavy use of tabs and newlines in
-- the error messages, which reduces the readability of the generated
-- virtual text otherwise.
local neotest_ns = vim.api.nvim_create_namespace("neotest")
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)

require("neotest").setup(opts)
end,

keys = require("config.keymaps").setup_neotest_keymaps(),
},
}
Loading