E5108: Error executing lua ...s\neovim\current\share\nvim\runtime/lua/vim/lsp/util.lua:110: Invalid encoding: "utf8"
stack traceback:
[C]: in function 'error'
...s\neovim\current\share\nvim\runtime/lua/vim/lsp/util.lua:110: in function '_str_utfindex_enc'
...s\neovim\current\share\nvim\runtime/lua/vim/lsp/util.lua:411: in function 'apply_text_edits'
...im-data\site\pack\packer\start\nvim-cmp/lua/cmp/core.lua:402: in function <...im-data\site\pack\packer\start\nvim-cmp/lua/cmp/core.lua:375>
...te\pack\packer\start\nvim-cmp/lua/cmp/utils/feedkeys.lua:51: in function <...te\pack\packer\start\nvim-cmp/lua/cmp/utils/feedkeys.lua:49>
is this normal? i m using windows btw.
i type print then tab for nvim-cmp. the error shows. i dont think i have did anything wrong.
This is a plugin error, not a neovim error. “utf-8” here refers to the offsetEncoding. Neovim follows clangd’s offsetEncoding Protocol extensions which allows servers to send utf-8 offsetEncodings (raw byte ranges), utf-16 encodings (2 byte code points), and utf-32 encodings (the direct 4 byte encodings of code units). These encodings are only used when representing Position params.
Recently, I realized many plugins were using lsp internal utility functions which relied on lazily resolving the offsetEncoding, and would indiscriminately fallback to utf-16 which is the only “official” encoding in the protocol. I changed this so all functions which deal with offsetEncoding require it to be explicitly passed. This helped me catch several bugs internally, and also made apparent some issues in plugins that were not handling multibyte edits correct.