nvf icon indicating copy to clipboard operation
nvf copied to clipboard

null-ls cannot be used with ccls due to `offset_encoding`

Open NotAShelf opened this issue 1 year ago • 5 comments

I've recently come to realize that we cannot use null-ls with ccls (which is the default lang server for C/C++ rn) due offset_encoding differences.

Thanks to this PR (#61) we are able to use clangd as the the language server, which will throw constant warnings for most of my C/C++ files.

warning: multiple different client offset_encodings detected for buffer, this is not supported yet

I've quickly attempted the suggested "fix" from here for null-ls, but doesn't seem to affect anything.

We should consider the following:

  1. disable null-ls for ccls (@n3oney this might be more for you)
  2. configure offset encodings for clangd to supress the multiple different client offset_encodings detected warning (@horriblename maybe you might know anything about this)

Relevant:

  • Null-ls issue: https://github.com/jose-elias-alvarez/null-ls.nvim/issues/428
  • Context around ccls: https://github.com/neovim/nvim-lspconfig/pull/1649
  • Neovim issue: https://github.com/neovim/neovim/pull/16694

NotAShelf avatar Jun 11 '23 10:06 NotAShelf

I don't understand, clangd works fine now right? why should it be changed?

horriblename avatar Jun 11 '23 11:06 horriblename

I'm not sure what's wrong for me then, I see this for quite literally ever .cpp file I open: image

NotAShelf avatar Jun 11 '23 13:06 NotAShelf

ah I'm guessing it's cos I disabled the git code action thing. alr, I'll look into it, should be an easy fix

horriblename avatar Jun 11 '23 15:06 horriblename

For ccls, I think filtering out the warnings is probably better than disabling null-ls. afaik vim.git.gitsigns.codeActions is using null-ls.

From the null-ls issue:

This is a legitimate warning, but if you don't care and just want to suppress it, you can filter it out by overriding vim.notify:

local notify = vim.notify
vim.notify = function(msg, ...)
    if msg:match("warning: multiple different client offset_encodings") then
        return
    end

    notify(msg, ...)
end

horriblename avatar Jun 11 '23 23:06 horriblename

I'm keeping this open for the time being, as any attempt at filtering the message (be it through vim.notify or nvim-notify) seems to fail.

NotAShelf avatar Jul 15 '23 07:07 NotAShelf