nvim-lspconfig
nvim-lspconfig copied to clipboard
ccls - warning: multiple different client offset_encodings detected for buffer, this is not supported yet
Description
When using nvim-lspconfig with ccls (note, not clangd), I get the following message:
warning: multiple different client offset_encodings detected for buffer, this is not supported yet
There's been a past issue about this with clangd here, https://github.com/neovim/nvim-lspconfig/issues/2184 and the server configuration documentation mentions, for clangd, to use "default capabilities, with offsetEncoding utf-8" but it's unclear to me how to apply the same advice to fix this for ccls. Could someone advise on what configuration is needed to fix this pretty spammy warning?
Neovim version
NVIM v0.9.0 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3 Compilation: /usr/bin/gcc-10 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/__w/neovim/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/build/src/nvim/auto -I/__w/neovim/neovim/build/include -I/__w/neovim/neovim/build/cmake.config -I/__w/neovim/neovim/src -I/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include -I/__w/neovim/neovim/.deps/usr/include
system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/__w/neovim/neovim/build/nvim.AppDir/usr/share/nvim"
Run :checkhealth for more info
Nvim-lspconfig version
8dc45a5c142f0b5a5dd34e5cdba33217d5dc6a86
Operating system and version
CentOS 7
Affected language servers
ccls
Steps to reproduce
- Compile the latest https://github.com/MaskRay/ccls (in my case, tag 0.20220729)
- Include the minimum config as a part of nvim-lspconfig
- Load a C++ file and wait. The warning shows
Actual behavior
Constant warnings about UTF encodings
Expected behavior
Normal LSP behavior
Minimal config
local lspconfig = require("lspconfig")
local capabilities = require("cmp_nvim_lsp").default_capabilities()
capabilities.offsetEncoding = "utf-8"
capabilities.offset_encoding = "utf-8"
capabilities.clang = {}
capabilities.clang.offsetEncoding = "utf-8"
capabilities.clang.offset_encoding = "utf-8"
lspconfig.ccls.setup { capabilities=capabilities }
LSP log
https://gist.github.com/ColinKennedy/1e0afe0158751bb9947902c831fdbe08
should be solved in nightly can you try latest version
By nightly, do you mean the latest commit of nvim-lspconfig? I've pulled up to deade69789089c3da15237697156334fb3e943f0 just now but it still gives the same error.
neovim latest build
I changed Neovim to the current nightly tag. At the time of writing it's
NVIM v0.10.0-dev-653+gfbeef0d4e
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
My nvim-treesitter was a bit out of date so I updated that too, to https://github.com/nvim-treesitter/nvim-treesitter/commit/90581acf873c62e72931bc7f4a070790e85cc131. nvim-lspconfig is also at its latest commit, https://github.com/neovim/nvim-lspconfig/commit/deade69789089c3da15237697156334fb3e943f0. With the same configuration posted above, I still get the multiple different client offset_encodings error.
I am having the same issue.
Same here.
Looks like it's hard-coded into ccls:
https://github.com/MaskRay/ccls/blob/f36ecb0c0e025f3f3a5c2d28c823316e5d0c48ba/src/messages/initialize.cc#L335-L343
https://github.com/MaskRay/ccls/blob/f36ecb0c0e025f3f3a5c2d28c823316e5d0c48ba/src/messages/initialize.cc#L224-L233
Search queries:
- https://github.com/search?q=repo%3AMaskRay%2Fccls%20encoding&type=code
- https://github.com/search?q=repo%3AMaskRay%2Fccls+InitializeResult&type=code
I am having this problem but for clangd. Has this been firgured out for clangd? I tried setting up the capabilities to utf 16 but it still pritns out the error message.
@AndreM222
For clangd, you'll want to refer to this other issue https://github.com/neovim/nvim-lspconfig/issues/2184. This issue is for ccls. Short answer though - clangd already has a setting for encoding, located here: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#clangd. And https://www.reddit.com/r/neovim/comments/18cb9d8/comment/kc9lre2/?utm_source=share&utm_medium=web2x&context=3
Btw the reason I was getting this warning
warning: multiple different client offset_encodings detected for buffer, this is not supported yet
I think was because at the time I was using null-ls at the same time as ccls. The two plugins were specifying different encodings which led to the warning. However I later moved onto nvim-lint. Somewhat against my will, I still miss null-ls. Apparently there's also none-ls but I haven't looked into whether that plugin has the same encoding bug