Install and configure yegappan/lsp for language support

This commit is contained in:
Danielle McLean 2023-10-05 18:27:14 +11:00
parent 390419188e
commit 8bd7acf409
Signed by: 00dani
GPG key ID: 52C059C3B22A753E
3 changed files with 71 additions and 3 deletions

View file

@ -103,3 +103,7 @@ g:mucomplete#can_complete = {
omni: (t) => strlen(&l:omnifunc) > 0 && t =~# '\m\k\%(\k\|\.\)$'
}
}
set keywordprg=:LspHover
source $XDG_CONFIG_HOME/vim/lsp.vim

66
config/vim/lsp.vim Normal file
View file

@ -0,0 +1,66 @@
vim9script
final lspServers = [
{
name: 'dockerfile-langserver',
filetype: 'dockerfile',
path: expand('~/.local/bin/docker-langserver'),
args: ['--stdio'],
install: 'npm install -g dockerfile-language-server-nodejs',
},
{
name: 'tilt-lsp',
filetype: 'bzl',
path: '/usr/local/bin/tilt',
args: ['lsp', 'start'],
install: 'brew install tilt',
},
{
name: 'typescript-language-server',
filetype: ['javascript', 'typescript'],
path: '/usr/local/bin/typescript-language-server',
args: ['--stdio'],
install: 'brew install typescript-language-server',
},
{
name: 'phpactor',
filetype: 'php',
path: expand('~/bin/phpactor'),
args: ['language-server'],
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'
},
{
name: 'pylsp',
filetype: 'python',
path: '/usr/local/bin/pylsp',
args: [],
install: 'brew install python-lsp-server',
},
{
name: 'vim-language-server',
filetype: 'vim',
path: expand('~/.local/bin/vim-language-server'),
args: ['--stdio'],
install: 'npm install -g vim-language-server',
},
]
final lspOptions = {
aleSupport: true,
}
autocmd VimEnter * ++once {
# :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 LspOptionsSet(lspOptions)
}

View file

@ -43,8 +43,7 @@ minpac#add('tpope/vim-unimpaired')
minpac#add('wincent/loupe')
minpac#add('wincent/terminus')
minpac#add('w0rp/ale')
minpac#add('neoclide/coc.nvim', {branch: 'release'})
minpac#add('yegappan/lsp')
minpac#add('vim-airline/vim-airline')
minpac#add('vim-airline/vim-airline-themes')
@ -61,7 +60,6 @@ minpac#add('ehamberg/vim-cute-python')
minpac#add('Glench/Vim-Jinja2-Syntax')
minpac#add('tweekmonster/braceless.vim')
minpac#add('ternjs/tern_for_vim', {do: () => async#job#start(['npm', 'install'], {})})
minpac#add('vito-c/jq.vim')
minpac#add('fladson/vim-kitty')