Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A language server for Bash

License

NotificationsYou must be signed in to change notification settings

bash-lsp/bash-language-server

 
 

Repository files navigation

Bash language server that brings an IDE-like experience for bash scripts to most editors. This is based on theTree Sitter parser and supportsexplainshell andshellcheck.

We strongly recommend that you installshellcheck to enable linting:https://github.com/koalaman/shellcheck#installing

Documentation around configuration variables can be found in theconfig.ts file.

Features

  • Jump to declaration
  • Find references
  • Code Outline & Show Symbols
  • Highlight occurrences
  • Code completion
  • Simple diagnostics reporting
  • Documentation for symbols on hover
  • Workspace symbols

To be implemented:

  • Rename symbol
  • Better jump to declaration and find references based on scope

Installation

Usually you want to install a client for your editor (see the section below).

But if you want to install the server binary:

npm i -g bash-language-server

On Fedora based distros:

dnf install -y nodejs-bash-language-server

To verify that everything is working:

bash-language-server --help

If you encounter installation errors, ensure you have node version 14 or newer (node --version).

Clients

The following editors and IDEs have available clients:

Vim

For Vim 8 or later install the pluginprabirshrestha/vim-lsp and add the following configuration to.vimrc:

ifexecutable('bash-language-server')auUserlsp_setupcalllsp#register_server({\'name':'bash-language-server',\'cmd': {server_info->[&shell, &shellcmdflag,'bash-language-server start']},\'allowlist': ['sh','bash'],\})endif

For Vim 8 or Neovim usingYouCompleteMe, add the following to.vimrc:

letg:ycm_language_server=\[\  {\'name':'bash',\'cmdline': ['bash-language-server','start' ],\'filetypes': ['sh' ],\  }\]

For Vim 8 or Neovim usingneoclide/coc.nvim, according toit's Wiki article, add the following to yourcoc-settings.json:

"languageserver": {"bash": {"command":"bash-language-server","args": ["start"],"filetypes": ["sh"],"ignoredRootPaths": ["~"]    }  }

For Vim 8 or NeoVim usingdense-analysis/ale add the followingconfiguration to your.vimrc:

letg:ale_linters= {\'sh': ['language_server'],\}

Neovim

For Neovim v0.8:

vim.api.nvim_create_autocmd('FileType', {pattern='sh',callback=function()vim.lsp.start({name='bash-language-server',cmd= {'bash-language-server','start'},    })end,})

For NeoVim usingautozimu/LanguageClient-neovim, add the following configuration toinit.vim:

letg:LanguageClient_serverCommands= {\'sh': ['bash-language-server','start']\}

For Vim8/NeoVim v0.5 usingjayli/vim-easycomplete. Execute:InstallLspServer sh and config nothing. Maybe it's the easiest way to use bash-language-server in vim/nvim.

Oni

On the config file (File -> Preferences -> Edit Oni config) add the following configuration:

"language.bash.languageServer.command":"bash-language-server","language.bash.languageServer.arguments":["start"],

Emacs

Lsp-mode has a built-in client, can be installed byuse-package.Add the configuration to your.emacs.d/init.el

(use-package lsp-mode:commands lsp:hook  (sh-mode. lsp))

Logging

The minimum logging level for the server can be adjusted using theBASH_IDE_LOG_LEVEL environment variableand through the generalworkspace configuration.

Development Guide

Please seedocs/development-guide for more information.


[8]ページ先頭

©2009-2025 Movatter.jp