On #Neovim, if a language server executable is not available when a buffer tries to attach to it, what would be the simplest way to retry, without closing and reopen neither the buffer nor the editor? I have an user event that will notify when it’s ready
@RosaCtrl There is `vim.lsp.enable`, which has the added documentation of:
```
Example: *lsp-restart* Passing `false` stops and detaches the client(s).
Thus you can "restart" LSP by disabling and re-enabling a given config:
>lua
vim.lsp.enable('clangd', false)
vim.lsp.enable('clangd', true)
```
@jmbuhr oh, damn! I didn’t want to migrate, I was happy setting up my servers in `after/ftplugin` calling `vim.lsp.start`, but `.enable` seems to be perfect here 😭 Thank you!
@RosaCtrl Calling vim.lsp.start again may also just work. lsp.enable just takes the client config as defined via lsp.config, but if you have everything inline in your lsp.start call it should end up with the same result.
@jmbuhr yeah, but my understanding is that `.enable` is smarter because it knows where to look for the configuration, while `.start` requires a table. I would like to add an auto command somewhere that just restarts whatever servers were attached, or failed to attach, for every open buffer. By taking a table, `.start` forces me to create the auto command in every `ftplugin`, or keep the tables in memory! Then I thought I can just remove the filetype from each normal buffer, and re-apply it… I think your original suggestion is definitely the way to go 🙂