-
-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can I run :LspInstallServer
with no interaction?
#654
Comments
not perfect, but here's what I ended up with for typescript @Itto1992 : vim -c ':LspUninstallServer typescript-language-server' -c ':qa'
vim /tmp/file.ts -S <(echo -e "LspInstallServer! \n while index(lsp_settings#installed_servers(), {'version': '', 'name': 'typescript-language-server'}) == -1 \n sleep 1 \n endwhile \n :qa") |
I wanted to do the same kind of scripted install. Still no simple recommended solution? In my case I'm trying to install 3 (bash, markdown, yaml), and the interactive prompting isn't so bad but trying to get it to block until ALL the installs are finished seems like it's going to be a pain. @rmartine-ias it looks like that waiting for completion is the part your workaround is for? |
@dbarnett yep, it wakes up every second to check if it's done. #!/usr/bin/env bash
vim -c ':LspUninstallServer bash-language-server' -c ':qa'
vim /tmp/file.sh -S <(echo -e "LspInstallServer! \n while index(lsp_settings#installed_servers(), {'version': '', 'name': 'bash-language-server'}) == -1 \n sleep 1 \n endwhile \n :qa")
vim -c ':LspUninstallServer marksman' -c ':qa'
vim /tmp/file.md -S <(echo -e "LspInstallServer! \n while index(lsp_settings#installed_servers(), {'version': '', 'name': 'marksman'}) == -1 \n sleep 1 \n endwhile \n :qa")
vim -c ':LspUninstallServer yaml-language-server' -c ':qa'
vim /tmp/file.yaml -S <(echo -e "LspInstallServer! \n while index(lsp_settings#installed_servers(), {'version': '', 'name': 'yaml-language-server'}) == -1 \n sleep 1 \n endwhile \n :qa") |
FYI I used a variation on this using I defined a function in my vimrc: " Helper for installing servers programmatically
func LspInstallServerThenQuit(name) abort
let s:lsp_server_installing = a:name
execute 'LspInstallServer!' a:name
call timer_start(500, funcref('s:QuitIfLspServerInstalled'), { 'repeat': 100 })
endfunc
func s:QuitIfLspServerInstalled(...) abort
for l:s in lsp_settings#installed_servers()
if l:s.name ==# s:lsp_server_installing | qa | endif
endfor
endfunc then called it from cli: $ vim +'set ft=sh' +'augroup lsp_auto_enable | autocmd!' +'call LspInstallServerThenQuit("bash-language-server")' Without the lsp_auto_enable thing I kept getting some weird error like
that kept blocking the commands from finishing. |
Thank you for creating this nice repo!
I use this repo every my vim-environment.
I am creating a docker environment for neovim.
And I want to install some servers in the Dockerfile like below.
However,
:LspInstallServer
requires a confirmation before installation, which blocks the installation.This phenomenon cannot be solved by declaring
ENV DEBIAN_FRONTEND noninteractive
.If there is any solution to run installation command without interaction, could you tell me how to do it?
Thank you in advance.
The text was updated successfully, but these errors were encountered: