kabouzeid / nvim-lspinstall

Provides the missing :LspInstall for nvim-lspconfig
MIT License
526 stars 67 forks source link

LspInstall prompt for missing servers #137

Open axieax opened 2 years ago

axieax commented 2 years ago

Hello, Is it possible to have an option to display a prompt (y/n) to install missing LSP servers for a language when its file type is open in one of the buffers? This is the case when the language server is not installed, but available to be installed. Thanks!

kabouzeid commented 2 years ago

You can write an autocmd in your config that uses, require'lspinstall'.is_server_installed(<lang>) and require'lspinstall'.install_server(<lang>) and vim's :confirm for the prompt

axieax commented 2 years ago

I've actually tried experimenting with that yesterday! I was using the BufEnter event, and the installer for some servers (such as Docker iirc) were registered as another buffer with the same filetype as the previous, causing an infinite loop.

kabouzeid commented 2 years ago

Ah yes. Then I don't know a good way right now. I want to write a whole new UI for installing and uninstalling which would also make this much easier, but I haven't had so much time lately.

axieax commented 2 years ago

Understandable, having a UI would definitely simplify this process! Would love to see it as a future feature :)

derektata commented 2 years ago

I wrote a script that parses the file's extension against the installed servers/list of available servers from servers.lua and prompts the user to install, however I'm running into the same behavior that @axieax did.

It technically installed the server, but it spawned other shells in the process as well.

Here's the prompt 🙂 recording

Weird behavior: recording