neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.46k stars 2.06k forks source link

LspInfo: Active Clients not attached reporting root dir as Running in single file mode #3229

Open thecontinium opened 2 months ago

thecontinium commented 2 months ago

Description

This happening because the test here is failing.

      if root_dir == nil or fname:sub(1, root_dir:len()) ~= root_dir then
        matched = false
      end

fname is the always associated with the original buffer so this test is always failing when finding a client that does not have the same root. I'm not sure why we can't rely purely on the root_dir from the client and remove this test ?

heygarrett commented 2 months ago

Could this be why I'm seeing a server attempt to start with a nil root_dir even though single_file_support is set to false? If not I'm happy to open a separate issue.

Edit: If anyone ends up here with the same issue as me, looks like it was a regression in neoconf that's since been fixed:
https://github.com/folke/neoconf.nvim/issues/74

thecontinium commented 2 months ago

I don't think so - this is purely what is displayed by LspInfo.

thecontinium commented 2 months ago

I'm don't use workspaces and I'm not familiar with how they are supposed to work so this test might be valid for some usage but if I change the code to the below it works for me.

      if root_dir == nil  then
        matched = false
      end