fix(nvim/lsp): Diagnostic not working properly

I don't even know why setting capabilities.textDocument.diagnostic to
vim.NIL fix the issue...
This commit is contained in:
Ahmad Ansori Palembani 2025-06-15 12:07:18 +07:00
parent d2c8504bc4
commit fe54bfdc5f
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: BA64F8B60AF3EFB6
2 changed files with 29 additions and 28 deletions

View file

@ -15,7 +15,7 @@
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
"nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" },
"nvim-lspconfig": { "branch": "master", "commit": "f6d31b1c17f1a338ddcf56aaa930a8c88e904662" },
"nvim-lspconfig": { "branch": "master", "commit": "7ad4a11cc5742774877c529fcfb2702f7caf75e4" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" },
"oil.nvim": { "branch": "master", "commit": "08c2bce8b00fd780fb7999dbffdf7cd174e896fb" },

View file

@ -76,23 +76,6 @@ return {
"nvim-lua/plenary.nvim",
"mason-org/mason.nvim",
},
opts = {
platform = {
type = "roblox",
},
types = {
roblox_security_level = "PluginSecurity",
},
sourcemap = {
enabled = true,
autogenerate = true, -- automatic generation when the server is attached
rojo_project_file = "default.project.json",
sourcemap_file = "sourcemap.json",
},
},
config = function(_, opts)
require("luau-lsp").setup(opts)
end,
},
{
"neovim/nvim-lspconfig",
@ -105,11 +88,12 @@ return {
diagnostics = {
underline = true,
update_in_insert = false,
virtual_text = {
spacing = 4,
source = "if_many",
prefix = "",
},
virtual_lines = true,
-- virtual_text = {
-- spacing = 4,
-- source = "if_many",
-- prefix = "•",
-- },
severity_sort = true,
signs = {
text = {
@ -126,6 +110,9 @@ return {
dynamicRegistration = true,
},
},
textDocument = {
diagnostic = vim.NIL, -- I don't know why, but I need to set this to vim.NIL otherwise diagnostic would show up
},
},
}
end,
@ -137,10 +124,10 @@ return {
-- Setup lspconfig
local has_cmp, cmp_nvim_lsp = pcall(require, "cmp_nvim_lsp")
local capabilities = vim.tbl_deep_extend(
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend(
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
capabilities,
has_cmp and cmp_nvim_lsp.default_capabilities() or {},
opts.capabilities or {}
)
@ -176,8 +163,8 @@ return {
},
},
}
-- "luau_lsp" already handle vim.lsp.enable(...), so it's no longer needed
vim.lsp.config["luau_lsp"] = {
-- "require("luau-lsp").setup(...)" already handle vim.lsp.enable(...), so it's no longer needed
vim.lsp.config("luau-lsp", {
capabilities = capabilities,
on_attach = on_attach,
settings = {
@ -190,6 +177,20 @@ return {
},
},
},
})
require("luau-lsp").setup {
platform = {
type = "roblox",
},
types = {
roblox_security_level = "PluginSecurity",
},
sourcemap = {
enabled = true,
autogenerate = true, -- automatic generation when the server is attached
rojo_project_file = "default.project.json",
sourcemap_file = "sourcemap.json",
},
}
--#endregion
--#region Rust