Skip to content

Commit

Permalink
Add documentation on how to fix utf-16 issue
Browse files Browse the repository at this point in the history
* the vim.lsp.protocol.make_client_capabilities() override setting the
  offsetEncoding to utf-16 for a language server. This circumvents the
  fix documented e.g. here: https://www.lazyvim.org/configuration/recipes#fix-clangd-offset-encoding
* see LazyVim/LazyVim#3028 for a background
  discussion ending up in finding this issue.
  • Loading branch information
olatheander committed Apr 24, 2024
1 parent a539070 commit 33ed0fd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ capabilities.textDocument.foldingRange = {
}
local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'}
for _, ls in ipairs(language_servers) do
-- Set offsetEncoding for clangd to utf-16 not to cause
-- "warning: multiple different client offset_encodings detected for buffer, this is not supported yet" under certain conditions
-- see https://github.com/LazyVim/LazyVim/issues/3028 for background.
-- This may apply to other language servers as well.
-- if ls == "clangd" then
-- capabilities.offsetEncoding = { "utf-16" }
-- end
require('lspconfig')[ls].setup({
capabilities = capabilities
-- you can add other fields for setting up lsp server in this table
Expand Down

0 comments on commit 33ed0fd

Please sign in to comment.