diff --git a/config/vim/lsp.vim b/config/vim/lsp.vim index b043fbf..28aadc6 100644 --- a/config/vim/lsp.vim +++ b/config/vim/lsp.vim @@ -1,12 +1,12 @@ vim9script -const lspServers = [ +final lspServers = [ { name: 'dockerfile-langserver', filetype: 'dockerfile', path: expand('~/.local/bin/docker-langserver'), args: ['--stdio'], - install: ['npm', 'install', '-g', 'dockerfile-language-server-nodejs'], + install: 'npm install -g dockerfile-language-server-nodejs', }, { @@ -14,7 +14,7 @@ const lspServers = [ filetype: 'bzl', path: '/usr/local/bin/tilt', args: ['lsp', 'start'], - install: ['brew', 'install', 'tilt'], + install: 'brew install tilt', }, { @@ -22,7 +22,7 @@ const lspServers = [ filetype: ['javascript', 'typescript'], path: '/usr/local/bin/typescript-language-server', args: ['--stdio'], - install: ['brew', 'install', 'typescript-language-server'], + install: 'brew install typescript-language-server', }, { @@ -33,7 +33,7 @@ const lspServers = [ initializationOptions: { 'language_server_configuration.auto_config': false, }, - install: ['bash', '-c', 'curl -Lo phpactor https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar && chmod u+x phpactor && mv phpactor ~/bin'], + install: 'curl -Lo phpactor https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar && chmod u+x phpactor && mv phpactor ~/bin' }, { @@ -41,15 +41,7 @@ const lspServers = [ filetype: 'python', path: '/usr/local/bin/pylsp', args: [], - install: ['brew', 'install', 'python-lsp-server'], - }, - - { - name: 'solargraph', - filetype: 'ruby', - path: '/usr/local/bin/solargraph', - args: ['stdio'], - install: ['brew', 'install', 'solargraph'], + install: 'brew install python-lsp-server', }, { @@ -57,25 +49,18 @@ const lspServers = [ filetype: 'vim', path: expand('~/.local/bin/vim-language-server'), args: ['--stdio'], - install: ['npm', 'install', '-g', 'vim-language-server'], + install: 'npm install -g vim-language-server', }, ] -const lspOptions = { +final lspOptions = { aleSupport: true, } autocmd VimEnter * ++once { - # TODO: work out a way nicer approach to automatically installing any - # missing language servers. Maybe use a command or something. - const missing = lspServers->copy() - ->filter((_, server) => !executable(server.path)) - const jobs = missing->copy() - ->mapnew((_, server) => async#job#start(server.install, {normalize: 'raw'})) - async#job#wait(jobs) # :call is required here because these functions from vim-lsp won't be # loaded yet when this file is parsed by Vim, so you get a "function not # found" error if you try to call them the short way. - call LspAddServer(lspServers->deepcopy()->filter((_, server) => executable(server.path))) + call LspAddServer(lspServers) call LspOptionsSet(lspOptions) }