fix(neovim): update virtual line format for diagnostics (#224)

* Only show diagnostic message in the current line
* Remove unused options

Reviewed-on: #224
Co-authored-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
Co-committed-by: Joao P Dubas <joao.dubas+gitea@gmail.com>
This commit is contained in:
João Paulo Dubas 2025-05-08 11:49:58 +00:00 committed by João Paulo Dubas
parent 678246e4ea
commit e5a8d1147b

View File

@ -1,5 +1,5 @@
diff --git a/init.lua b/init.lua diff --git a/init.lua b/init.lua
index 776c687..040cf83 100644 index 776c687..6ae630e 100644
--- a/init.lua --- a/init.lua
+++ b/init.lua +++ b/init.lua
@@ -91,7 +91,7 @@ vim.g.mapleader = ' ' @@ -91,7 +91,7 @@ vim.g.mapleader = ' '
@ -39,18 +39,28 @@ index 776c687..040cf83 100644
-- [[ Basic Keymaps ]] -- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()` -- See `:help vim.keymap.set()`
@@ -632,7 +640,9 @@ require('lazy').setup({ @@ -632,9 +640,9 @@ require('lazy').setup({
[vim.diagnostic.severity.HINT] = '󰌶 ', [vim.diagnostic.severity.HINT] = '󰌶 ',
}, },
} or {}, } or {},
- virtual_text = { - virtual_text = {
- source = 'if_many',
- spacing = 2,
+ virtual_text = false, + virtual_text = false,
+ -- Display multiline diagnostics on virtual lines + -- Display multiline diagnostics on virtual lines
+ virtual_lines = { + virtual_lines = {
source = 'if_many',
spacing = 2,
format = function(diagnostic) format = function(diagnostic)
@@ -676,6 +686,28 @@ require('lazy').setup({ local diagnostic_message = {
[vim.diagnostic.severity.ERROR] = diagnostic.message,
@@ -644,6 +652,7 @@ require('lazy').setup({
}
return diagnostic_message[diagnostic.severity]
end,
+ current_line = true,
},
}
@@ -676,6 +685,28 @@ require('lazy').setup({
-- ts_ls = {}, -- ts_ls = {},
-- --
@ -79,7 +89,7 @@ index 776c687..040cf83 100644
lua_ls = { lua_ls = {
-- cmd = { ... }, -- cmd = { ... },
-- filetypes = { ... }, -- filetypes = { ... },
@@ -690,6 +722,32 @@ require('lazy').setup({ @@ -690,6 +721,32 @@ require('lazy').setup({
}, },
}, },
}, },
@ -112,7 +122,7 @@ index 776c687..040cf83 100644
} }
-- Ensure the servers and tools above are installed -- Ensure the servers and tools above are installed
@@ -721,6 +779,33 @@ require('lazy').setup({ @@ -721,6 +778,33 @@ require('lazy').setup({
-- by the server configuration above. Useful when disabling -- by the server configuration above. Useful when disabling
-- certain features of an LSP (for example, turning off formatting for ts_ls) -- certain features of an LSP (for example, turning off formatting for ts_ls)
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
@ -146,7 +156,7 @@ index 776c687..040cf83 100644
require('lspconfig')[server_name].setup(server) require('lspconfig')[server_name].setup(server)
end, end,
}, },
@@ -801,6 +886,8 @@ require('lazy').setup({ @@ -801,6 +885,8 @@ require('lazy').setup({
opts = {}, opts = {},
}, },
'folke/lazydev.nvim', 'folke/lazydev.nvim',
@ -155,7 +165,7 @@ index 776c687..040cf83 100644
}, },
--- @module 'blink.cmp' --- @module 'blink.cmp'
--- @type blink.cmp.Config --- @type blink.cmp.Config
@@ -846,9 +933,15 @@ require('lazy').setup({ @@ -846,9 +932,15 @@ require('lazy').setup({
}, },
sources = { sources = {
@ -172,7 +182,7 @@ index 776c687..040cf83 100644
}, },
}, },
@@ -874,19 +967,39 @@ require('lazy').setup({ @@ -874,19 +966,39 @@ require('lazy').setup({
-- --
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim', 'folke/tokyonight.nvim',
@ -218,7 +228,7 @@ index 776c687..040cf83 100644
end, end,
}, },
@@ -936,7 +1049,39 @@ require('lazy').setup({ @@ -936,7 +1048,39 @@ require('lazy').setup({
main = 'nvim-treesitter.configs', -- Sets main module to use for opts main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = { opts = {
@ -259,7 +269,7 @@ index 776c687..040cf83 100644
-- Autoinstall languages that are not installed -- Autoinstall languages that are not installed
auto_install = true, auto_install = true,
highlight = { highlight = {
@@ -966,17 +1111,17 @@ require('lazy').setup({ @@ -966,17 +1110,17 @@ require('lazy').setup({
-- Uncomment any of the lines below to enable them (you will need to restart nvim). -- Uncomment any of the lines below to enable them (you will need to restart nvim).
-- --
-- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.debug',