Reputation: 3308
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068
WSL2
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
Also, I am using nvchad with lazyvim
Disable the virtual text that shows against code lines, when there any error/warning/info.
I want to disable the virtual text and have it shown in a hover window on click of some keys (g + l)
~/.config/nvim/init.lua
vim.diagnostic.config({
signs = true,
underline = true,
update_in_insert = false,
virtual_text = false,
severity_sort = true,
})
~/.config/nvim/lua/configs/lspconfig.lua
like below..-- load defaults i.e lua_lsp
require("nvchad.configs.lspconfig").defaults()
local lspconfig = require "lspconfig"
-- EXAMPLE
local servers = { "html", "cssls", "rust_analyzer" }
local nvlsp = require "nvchad.configs.lspconfig"
-- Define custom LSP options
local custom_opts = {
diagnostics = {
underline = true,
update_in_insert = false,
virtual_text = false,
severity_sort = true,
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "",
[vim.diagnostic.severity.INFO] = "",
},
},
},
inlay_hints = {
enabled = true,
exclude = { "vue" },
},
document_highlight = {
enabled = true,
},
capabilities = nvlsp.capabilities,
}
-- lsps with default config
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
on_attach = nvlsp.on_attach,
on_init = nvlsp.on_init,
-- capabilities = nvlsp.capabilities,
capabilities = custom_opts.capabilities,
settings = custom_opts,
}
end
But with no luck. The errors are shown inline. Any help is highly appreciated.
Upvotes: 1
Views: 596
Reputation: 1
The closest I could get was to use - vim.diagnostic.enable(false)
;
which works, but disables linters as well.
Upvotes: 0