Compare commits

..

No commits in common. "87147d44a3a8a521c77b3ef528c7b3691c5ff062" and "8bd7acf4094a1bbd973aa79e0b852995a07244d9" have entirely different histories.

View file

@ -1,12 +1,12 @@
vim9script vim9script
const lspServers = [ final lspServers = [
{ {
name: 'dockerfile-langserver', name: 'dockerfile-langserver',
filetype: 'dockerfile', filetype: 'dockerfile',
path: expand('~/.local/bin/docker-langserver'), path: expand('~/.local/bin/docker-langserver'),
args: ['--stdio'], 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', filetype: 'bzl',
path: '/usr/local/bin/tilt', path: '/usr/local/bin/tilt',
args: ['lsp', 'start'], args: ['lsp', 'start'],
install: ['brew', 'install', 'tilt'], install: 'brew install tilt',
}, },
{ {
@ -22,7 +22,7 @@ const lspServers = [
filetype: ['javascript', 'typescript'], filetype: ['javascript', 'typescript'],
path: '/usr/local/bin/typescript-language-server', path: '/usr/local/bin/typescript-language-server',
args: ['--stdio'], args: ['--stdio'],
install: ['brew', 'install', 'typescript-language-server'], install: 'brew install typescript-language-server',
}, },
{ {
@ -33,7 +33,7 @@ const lspServers = [
initializationOptions: { initializationOptions: {
'language_server_configuration.auto_config': false, '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', filetype: 'python',
path: '/usr/local/bin/pylsp', path: '/usr/local/bin/pylsp',
args: [], args: [],
install: ['brew', 'install', 'python-lsp-server'], install: 'brew install python-lsp-server',
},
{
name: 'solargraph',
filetype: 'ruby',
path: '/usr/local/bin/solargraph',
args: ['stdio'],
install: ['brew', 'install', 'solargraph'],
}, },
{ {
@ -57,25 +49,18 @@ const lspServers = [
filetype: 'vim', filetype: 'vim',
path: expand('~/.local/bin/vim-language-server'), path: expand('~/.local/bin/vim-language-server'),
args: ['--stdio'], args: ['--stdio'],
install: ['npm', 'install', '-g', 'vim-language-server'], install: 'npm install -g vim-language-server',
}, },
] ]
const lspOptions = { final lspOptions = {
aleSupport: true, aleSupport: true,
} }
autocmd VimEnter * ++once { 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 # :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 # 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. # 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) call LspOptionsSet(lspOptions)
} }