From 0ace78175a5df66e3cf2c3a4b33ea339532fc082 Mon Sep 17 00:00:00 2001 From: jl54 Date: Sun, 23 Mar 2025 21:41:45 +0100 Subject: [PATCH] add inline error messages --- init.lua | 2 ++ lua/custom/diagnostics.lua | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 lua/custom/diagnostics.lua diff --git a/init.lua b/init.lua index 738efe2d..34118321 100644 --- a/init.lua +++ b/init.lua @@ -599,6 +599,8 @@ require('lazy').setup({ }, } + require('custom.diagnostics').setup() + -- Ensure the servers and tools above are installed -- To check the current status of installed tools and/or manually install -- other tools, you can run diff --git a/lua/custom/diagnostics.lua b/lua/custom/diagnostics.lua new file mode 100644 index 00000000..016ce798 --- /dev/null +++ b/lua/custom/diagnostics.lua @@ -0,0 +1,28 @@ +-- Custom LSP diagnostic configuration +local M = {} + +M.setup = function() + vim.diagnostic.config { + virtual_text = { + prefix = '●', -- Change symbol if needed + spacing = 4, + }, + signs = true, + underline = true, + update_in_insert = false, + severity_sort = true, + float = { + source = 'always', + }, + } + + -- Show diagnostics in a floating window when hovering + vim.o.updatetime = 250 + vim.api.nvim_create_autocmd('CursorHold', { + callback = function() + vim.diagnostic.open_float(nil, { focusable = false }) + end, + }) +end + +return M