BashlanguageserverimplementationbasedonTreeSitteranditsgrammarforBashwithexplainshellintegration.
FeaturesJumptodeclarationFindreferencesCodeOutline&ShowSymbolsHighlightoccurrencesCodecompletionSimplediagnosticsreportingDocumentationforflagsonhoverWorkspacesymbolsRenamesymbolInstallationnpmi-gbash-language-serverIfyouencounterinstallationerrors,ensureyouhavenodeversion8ornewer(node--version).
ClientsThefollowingeditorsandIDEshaveavailableclients:
VisualStudioCode(BashIDE)Atom(ide-bash)SublimeText(LSP-bash)Vim(seebelow)Neovim(seebelow)Oni(seebelow)Eclipse(ShellWax)Emacs(seebelow)JupyterLab(jupyterlab-lsp)VimForVim8orlaterinstallthepluginprabirshrestha/vim-lspandaddthefollowingconfigurationto.vimrc:
ifexecutable('bash-language-server')auUserlsp_setupcalllsp#register_server({\'name':'bash-language-server',\'cmd':{server_info->[&shell,&shellcmdflag,'bash-language-serverstart']},\'allowlist':['sh'],\})endifForVim8orNeovimusingneoclide/coc.nvim,accordingtoit'sWikiarticle,addthefollowingtoyourcoc-settings.json:
"languageserver":{"bash":{"command":"bash-language-server","args":["start"],"filetypes":["sh"],"ignoredRootPaths":["~"]}}ForVim8orNeoVimusingdense-analysis/aleaddthefollowingconfigurationtoyour.vimrc:
letg:ale_linters={\'sh':['language_server'],\}NeovimForNeoVimusingautozimu/LanguageClient-neovim,addthefollowingconfigurationtoinit.vim:
letg:LanguageClient_serverCommands={\'sh':['bash-language-server','start']\}ForNeoVimv0.5(nightly)usingitsbuilt-inlsp,installneovim/nvim-lspconfigandaddthefollowingconfigurationtoeitheryourinit.vimorinit.lua
init.vim:
luarequire'lspconfig'.bashls.setup{}or
init.lua:
require'lspconfig'.bashls.setup{}OniOntheconfigfile(File->Preferences->EditOniconfig)addthefollowingconfiguration:
"language.bash.languageServer.command":"bash-language-server","language.bash.languageServer.arguments":["start"],EmacsLsp-modehasabuilt-inclient,canbeinstalledbyuse-package.Addtheconfigurationtoyour.emacs.d/init.el
(use-packagelsp-mode:commandslsp:hook(sh-mode.lsp))DevelopmentGuidePleaseseedocs/development-guideformoreinformation.
评论