dotfiles
dotfiles copied to clipboard
LSP: Unhandled method textDocument/diagnostic
LSP error on html and css. Best related issues I could find were:
- https://github.com/dkarter/dotfiles/commit/4c6bcce0d120dbc1ba9cb2f76dad25c5213c0459
- https://github.com/lervag/dotnvim/blob/6cd042d9a0e96dd36b27c8b19532c081017cec67/plugin/lsp.lua#L14-L21 According with this one, it also happens on jsonls, and it points to being a problem with cmp_nvim_lsp overwriting the
capabilities.textDocument"wrongly"
However I was not able to reproduce with a minimal config of only lspconfig and cmp with cmp_nvim_lsp. Tried disabling other plugins and tweaking other things in my config that I thought may be the reason, but couldn't find the root of the problem. No idea of where this is coming from.
Minimal config I tried:
local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"
local install_dir = temp_dir .. "/lazy-nvim"
-- set stdpaths to use "/tmp/lazy-nvim"
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = install_dir .. "/" .. name
end
-- bootstrap lazy
local lazypath = install_dir .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"--single-branch",
"https://github.com/folke/lazy.nvim.git",
lazypath,
})
end
vim.opt.runtimepath:prepend(lazypath)
-- install plugins
local plugins = {
{ "neovim/nvim-lspconfig" },
{
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{ "hrsh7th/cmp-nvim-lsp" },
},
config = function()
local cmp = require("cmp")
cmp.setup({
mapping = {
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Select }),
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Select }),
["<C-Space>"] = cmp.mapping.complete(),
["<C-y>"] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }),
},
sources = { { name = "nvim_lsp", priority = 1000 } },
})
end,
},
}
require("lazy").setup(plugins, {
root = install_dir .. "/plugins",
})
local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("lspconfig").html.setup({
cmd = { "/home/$USER/.local/share/nvim/mason/bin/vscode-html-language-server", "--stdio" },
capabilities = capabilities,
})
vim.opt.termguicolors = true
vim.cmd.colorscheme("habamax")