fidget.nvim icon indicating copy to clipboard operation
fidget.nvim copied to clipboard

clang12 - failed "lsp.lua:93: attempt to call field 'get_clients' (a nil value) " - seems to only work tag="legacy"

Open MontyTHall opened this issue 1 year ago • 3 comments

neovim v0.10 - using packer

NOTE: Just switched to lazy. Still having the same problem.

	use {
		'j-hui/fidget.nvim',
		config = function()
			require("fidget").setup({})
		end
	}

I'm starting clangd in the following way:

	require('mason-lspconfig').setup({
		handlers = {
			lsp_zero.default_setup,
			clangd = function()
				lspconfig.clangd.setup({
					cmd = { 'clangd-12', '-j=6', '--background-index', '--clang-tidy' }
				})
			end
		}
	})

I see clangd-12 running as a process. I'm not sure what I'm doing wrong. If I switch to tag=legacy things "work" though I'm not sure what I'm missing in terms of the latest and greated fidget features.

When I open a *cpp file w/ a compile_commands.json at the project root, I get the error shown in the subject. :LspInfo shows the following:

 Press q or <Esc> to close this window. Press <Tab> to view server doc.
 
 Language client log: XXXX/lsp.log
 Detected filetype:   cpp
 
 1 client(s) attached to this buffer: 
 
 Client: clangd (id: 2, bufnr: [1])
 	filetypes:       c, cpp, objc, objcpp, cuda, proto
 	autostart:       true
 	root directory: XXXX
 	cmd:             /usr/bin/clangd-12 -j=6 --background-index --clang-tidy
 
 1 active client(s) not attached to this buffer: 
 
 Client: copilot (id: 1, bufnr: [])
 	filetypes:       
 	autostart:       false
 	root directory:  Running in single file mode.
 	cmd:             node XXXX/.local/share/nvim/site/pack/packer/start/copilot.vim/dist/agent.js --stdio
 
 Configured servers list: cssls, rust_analyzer, bashls, jsonls, julials, pyright, texlab, dockerls, lua_ls, dotls, clangd, html, marksman, taplo, lemminx, sqlls, yamlls, tsserver

Here's a little snippet of lsp.log with verbose logging turned on:

[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	"I[17:38:09.422] --> $/progress\n"
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	'V[17:38:09.423] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"0/6","percentage":0}}}\n\n'
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	"I[17:38:09.423] --> $/progress\n"
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	'V[17:38:09.423] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"1/6","percentage":16.666666666666668}}}\n\n'
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	'I[17:38:09.424] --> $/progress\nV[17:38:09.424] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"1/6","percentage":16.666666666666668}}}\n\n'
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	"I[17:38:09.424] --> $/progress\n"
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	'V[17:38:09.424] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"1/6","percentage":16.666666666666668}}}\n\n'
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	"I[17:38:09.424] --> $/progress\n"
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	'V[17:38:09.424] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"1/6","percentage":16.666666666666668}}}\n\n'
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	'I[17:38:09.424] --> $/progress\nV[17:38:09.424] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"1/6","percentage":16.666666666666668}}}\n\n'
[ERROR][2024-02-26 17:38:09] .../vim/lsp/rpc.lua:677	"rpc"	"/usr/bin/clangd-12"	"stderr"	'I[17:38:09.424] --> $/progress\nV[17:38:09.424] >>> {"jsonrpc":"2.0","method":"$/progress","params":{"token":"backgroundIndexProgress","value":{"kind":"report","message":"1/6","percentage":16.666666666666668}}}\n\n'

Just switched back to the legacy tag - and the progress spinner appears and no errors.

MontyTHall avatar Feb 26 '24 22:02 MontyTHall

I just installed on my desktop. Running ubuntu 22 and it has clangd-15 - basically the same configuration. fidget does in fact work. So I decided to install cland-15 on my unbuntu-20 work laptop. No dice. I wonder if it's an OS related issue - perhaps polling is different. Just a stab in the dark.

image

MontyTHall avatar Feb 29 '24 03:02 MontyTHall

Same reason my telescope ui was failing I've been running v0.10. Rolled back to v0.9.5 - everythig works.

MontyTHall avatar Mar 03 '24 04:03 MontyTHall

Sorry for not getting to this sooner. This error shouldn't have anything to do with polling, your OS, or the version of clangd.

But the error also doesn't really make any sense to me, since vim.lsp.get_clients() is part of Neovim's built-in LSP framework (see :h vim.lsp.get_clients()). So I don't see why it's complaining that the get_clients() function doesn't exist, unless your Neovim build happens to be built from some (now-outdated) commit before the get_clients() function was introduced.

How exactly are you building "v0.10"? In particular, what commit is HEAD at when you built Neovim? (Or how are you installing it?) The output of running :version will be helpful here.

For what it's worth, I just tested with the latest commit on Neovim master and Fidget still works.

j-hui avatar Mar 18 '24 19:03 j-hui

Closing due to lack of activity. Please re-open if you have encountered this issue again.

j-hui avatar Jul 07 '24 02:07 j-hui