Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

LspInstall prompt for missing servers #137

Open
axieax opened this issue Aug 12, 2021 · 5 comments
Open

LspInstall prompt for missing servers #137

axieax opened this issue Aug 12, 2021 · 5 comments

Comments

@axieax
Copy link

axieax commented Aug 12, 2021

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
Copy link
Owner

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
Copy link
Author

axieax commented Aug 13, 2021

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
Copy link
Owner

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
Copy link
Author

axieax commented Aug 14, 2021

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

@derektata
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants