hinell / lsp-timeout.nvim

Start/stop LSP servers upon demand; keeps RAM usage low
Other
195 stars 6 forks source link

null-ls sources don't reload after restoring lsp clients #7

Closed Zeioth closed 9 months ago

Zeioth commented 9 months ago

Summary

This is my :NullLsInfo when I open my file (it's loading beautysh).

screenshot_2023-10-16_05-22-47_969674073

And this is the same lsp-timeout reload the clients (it doesn't load it anymore) screenshot_2023-10-16_05-22-28_698973754

Just to clarify, null-ls itself works fine (for example, on C, it will work correctly after restoring lsp-timeout because it don't require sources).

If you could try to reproduce, I would be thankful.

Steps to reproduce

When restoring, you should be able to reproduce.

Versions

Zeioth commented 9 months ago

Easier way to reproduce

Maybe null-ls times out? When I do :LspRestart, I don't experience this bug.

Zeioth commented 9 months ago

It seems manually running :lua require("null-ls").enable({}) after :LspStart fixes the issue. I'm gonna keep testing.

hinell commented 9 months ago

Anticipated per troubleshooting.

The null-ls got archived (as of Aug 12, 2023) so you are better to look for alternatives like efm-langserver

Plugins requiring active LSP may fail or misbehave if they fail to hook into LSP events: LspAttach or LspDetach; It seems like nul-ls fails to do so.

Workaround

It seems manually running :lua require("null-ls").enable({})

I suggets to create an autocmd for that as a workaround and tell me whether it works or not:

    vim.api.nvim_create_autocmd("LspAttach", {
      callback = function(args)
           require("null-ls").enable({})
    })

I would strongly suggest to drop null-ls.

Zeioth commented 9 months ago

Cool I was writing it. We reached the solution at the same time.

  vim.api.nvim_create_autocmd({ "LspAttach" }, {
    desc = "Start null-ls when starting a lsp client",
    callback = function()
      pcall(function() require("null-ls").enable({}) end)
    end,
  })

Ok with that I can fix it on NormalNvim. If you don't want to PR the change, at least would maybe be nice adding it to the readme, because it's a issue many people will propably find.

I use none-ls for now, but I'm secretly rooting for efm-langserver. I think it is a better approach.

hinell commented 9 months ago

Reflected in docs:

https://github.com/hinell/lsp-timeout.nvim/blob/main/doc/index.md#troubleshooting