Compare commits

..

2 commits

View file

@ -1,12 +1,12 @@
vim9script
final lspServers = [
const 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 @@ final lspServers = [
filetype: 'bzl',
path: '/usr/local/bin/tilt',
args: ['lsp', 'start'],
install: 'brew install tilt',
install: ['brew', 'install', 'tilt'],
},
{
@ -22,7 +22,7 @@ final 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 @@ final lspServers = [
initializationOptions: {
'language_server_configuration.auto_config': false,
},
install: 'curl -Lo phpactor https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar && chmod u+x phpactor && mv phpactor ~/bin'
install: ['bash', '-c', 'curl -Lo phpactor https://github.com/phpactor/phpactor/releases/latest/download/phpactor.phar && chmod u+x phpactor && mv phpactor ~/bin'],
},
{
@ -41,7 +41,15 @@ final lspServers = [
filetype: 'python',
path: '/usr/local/bin/pylsp',
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'],
},
{
@ -49,18 +57,25 @@ final 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'],
},
]
final lspOptions = {
const 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)
call LspAddServer(lspServers->deepcopy()->filter((_, server) => executable(server.path)))
call LspOptionsSet(lspOptions)
}