2.6 KiB
[!Important]
Flux-LSP no longer maintained
The
flux-lspFlux Language Server Protocol plugin is no longer maintained. Theflux-lsprepo has been archived and is no longer receiving updates.
Requirements
- Vim 8+
- npm
Install the Flux plugin
There are many ways to install and manage Vim plugins. We recommend either of the following two methods:
Both methods require you to add the following to your .vimrc so that Vim can recognize the .flux file type:
" Flux file type
au BufRead,BufNewFile *.flux set filetype=flux
Install with vim-lsp
-
Install
flux-lsp-cliwith npmnpm i -g @influxdata/flux-lsp-cli -
Install vim-lsp
If it doesn't exist yet, create a directory called
pack/$USER/start/in your~/.vim/and clonevim-lspinto it:cd ~ mkdir -p .vim/pack/$USER/start/ cd .vim/pack/$USER/start/ git clone https://github.com/prabirshrestha/vim-lsp -
Edit your
.vimrcNext, edit your
.vimrcconfiguration file to include the following:let g:lsp_diagnostics_enabled = 1 if executable('flux-lsp') au User lsp_setup call lsp#register_server({ \ 'name': 'flux lsp', \ 'cmd': {server_info->[&shell, &shellcmdflag, 'flux-lsp']}, \ 'whitelist': ['flux'], \ }) endif autocmd FileType flux nmap gd <plug>(lsp-definition)
Install with vim-coc
-
Install
flux-lsp-clifrom npmnpm i -g @influxdata/flux-lsp-cli -
Install plug-vim
Install plug-vim, a plugin manager for Vim.
-
Install vim-coc
Install vim-coc, a code-completion plugin for Vim.
-
Configure vim-coc
vim-coc uses a
coc-settings.jsonlocated in your~/.vim/directory. To run the Flux LSP, add the Flux section underlanguageserver:{ "languageserver": { "flux": { "command": "flux-lsp", "filetypes": ["flux"] } } }To debug flux-lsp, configure it to log to
/tmp/fluxlsp:{ "languageserver": { "flux": { "command": "flux-lsp", "args": ["-l", "/tmp/fluxlsp"], "filetypes": ["flux"] } } }