Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP: Unhandled method textDocument/diagnostic #2

Open
rafamadriz opened this issue May 28, 2024 · 1 comment
Open

LSP: Unhandled method textDocument/diagnostic #2

rafamadriz opened this issue May 28, 2024 · 1 comment

Comments

@rafamadriz
Copy link
Owner

rafamadriz commented May 28, 2024

LSP error on html and css. Best related issues I could find were:

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.

Screenshot from 2024-05-27 22-30-49

@rafamadriz
Copy link
Owner Author

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")

rafamadriz added a commit that referenced this issue May 28, 2024
I hope this is a temporal fix for #2

* remove redundant `cmp.config.sources` in cmp sources configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant