{"id":13479128,"url":"https://github.com/bash-lsp/bash-language-server","last_synced_at":"2025-05-12T15:23:00.891Z","repository":{"id":37045885,"uuid":"122759875","full_name":"bash-lsp/bash-language-server","owner":"bash-lsp","description":"A language server for Bash","archived":false,"fork":false,"pushed_at":"2025-04-23T08:03:29.000Z","size":4349,"stargazers_count":2328,"open_issues_count":99,"forks_count":132,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-04-23T17:15:43.132Z","etag":null,"topics":["bash","language-server"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bash-lsp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-24T16:55:00.000Z","updated_at":"2025-04-23T17:00:07.000Z","dependencies_parsed_at":"2024-02-22T22:24:42.262Z","dependency_job_id":"ce337899-760d-491d-b9c7-afb5a6ae17f6","html_url":"https://github.com/bash-lsp/bash-language-server","commit_stats":{"total_commits":1098,"total_committers":54,"mean_commits":"20.333333333333332","dds":0.5091074681238615,"last_synced_commit":"1cd3b5580b4e58d59e7cd1269336241b7ae6b459"},"previous_names":["mads-hartmann/bash-language-server"],"tags_count":143,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bash-lsp%2Fbash-language-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bash-lsp%2Fbash-language-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bash-lsp%2Fbash-language-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bash-lsp%2Fbash-language-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bash-lsp","download_url":"https://codeload.github.com/bash-lsp/bash-language-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250477819,"owners_count":21437049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","language-server"],"created_at":"2024-07-31T16:02:10.033Z","updated_at":"2025-04-23T17:15:54.618Z","avatar_url":"https://github.com/bash-lsp.png","language":"TypeScript","readme":"# Bash Language Server\n\nBash language server that brings an IDE-like experience for bash scripts to most editors. This is based on the [Tree Sitter parser][tree-sitter-bash] and supports [explainshell][explainshell], [shellcheck][shellcheck] and [shfmt][shfmt].\n\nDocumentation around configuration variables can be found in the [config.ts](https://github.com/bash-lsp/bash-language-server/blob/main/server/src/config.ts) file.\n\n## Features\n\n- Jump to declaration\n- Find references\n- Code Outline \u0026 Show Symbols\n- Highlight occurrences\n- Code completion\n- Simple diagnostics reporting\n- Documentation for symbols on hover\n- Workspace symbols\n- Rename symbol\n- Format document\n\nTo be implemented:\n\n- Better jump to declaration and find references based on scope\n\n## Installation\n\n### Dependencies\n\nAs a dependency, we recommend that you first install [shellcheck][shellcheck] to enable linting:\nhttps://github.com/koalaman/shellcheck#installing . If `shellcheck` is installed,\nbash-language-server will automatically call it to provide linting and code analysis each time the\nfile is updated (with debounce time of 500ms).\n\nIf you want your shell scripts to be formatted consistently, you can install [shfmt][shfmt]. If\n`shfmt` is installed then your documents will be formatted whenever you take the 'format document'\naction. In most editors this can be configured to happen automatically when files are saved.\n\n### Bash language server\n\nUsually you want to install a client for your editor (see the section below).\n\nBut if you want to install the server binary (for examples for editors, like helix, where a generic LSP client is built in), you can install from npm registry as:\n\n```bash\nnpm i -g bash-language-server\n```\n\nAlternatively, bash-language-server may also be distributed directly by your Linux distro, for example on Fedora based distros:\n\n```bash\ndnf install -y nodejs-bash-language-server\n```\n\nOr on Ubuntu with snap:\n\n```bash\nsudo snap install bash-language-server --classic\n```\n\nTo verify that everything is working:\n\n```bash\nbash-language-server --help\n```\n\nIf you encounter installation errors, ensure you have node version 16 or newer (`node --version`).\n\n### Clients\n\nThe following editors and IDEs have available clients:\n\n- Atom ([ide-bash][ide-bash])\n- Eclipse ([ShellWax](https://marketplace.eclipse.org/content/shellwax))\n- Emacs ([see below](#emacs))\n- [Helix](https://helix-editor.com/) (built-in support)\n- JupyterLab ([jupyterlab-lsp][jupyterlab-lsp])\n- Neovim ([see below](#neovim))\n- Sublime Text ([LSP-bash][sublime-text-lsp])\n- Vim ([see below](#vim))\n- Visual Studio Code ([Bash IDE][vscode-marketplace])\n- [Oni](https://github.com/onivim/oni) ([see below](#oni))\n\n#### Vim\n\nFor Vim 8 or later install the plugin [prabirshrestha/vim-lsp][vim-lsp] and add the following configuration to `.vimrc`:\n\n```vim\nif executable('bash-language-server')\n  au User lsp_setup call lsp#register_server({\n        \\ 'name': 'bash-language-server',\n        \\ 'cmd': {server_info-\u003e['bash-language-server', 'start']},\n        \\ 'allowlist': ['sh', 'bash'],\n        \\ })\nendif\n```\n\nFor Vim 8 or Neovim using [YouCompleteMe](https://github.com/ycm-core/YouCompleteMe), add the following to `.vimrc`:\n\n```vim\nlet g:ycm_language_server =\n            \\ [\n            \\   {\n            \\       'name': 'bash',\n            \\       'cmdline': [ 'bash-language-server', 'start' ],\n            \\       'filetypes': [ 'sh' ],\n            \\   }\n            \\ ]\n```\n\nFor Vim 8 or Neovim using [neoclide/coc.nvim][coc.nvim], according to [it's Wiki article](https://github.com/neoclide/coc.nvim/wiki/Language-servers#bash), add the following to your `coc-settings.json`:\n\n```jsonc\n  \"languageserver\": {\n    \"bash\": {\n      \"command\": \"bash-language-server\",\n      \"args\": [\"start\"],\n      \"filetypes\": [\"sh\"],\n      \"ignoredRootPaths\": [\"~\"]\n    }\n  }\n```\n\nFor Vim 8 or NeoVim using [dense-analysis/ale][vim-ale] add the following\nconfiguration to your `.vimrc`:\n\n```vim\nlet g:ale_linters = {\n    \\ 'sh': ['language_server'],\n    \\ }\n```\n\nFor Vim8/NeoVim v0.5 using [jayli/vim-easycomplete](https://github.com/jayli/vim-easycomplete). Execute `:InstallLspServer sh` and config nothing. Maybe it's the easiest way to use bash-language-server in vim/nvim.\n\n#### Neovim\n\nFor Neovim 0.11+ with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)\n\n```lua\nvim.lsp.enable 'bashls'\n```\nFor Neovim 0.11+ without plugins\n\n```lua\nvim.lsp.config.bashls = {\n  cmd = { 'bash-language-server', 'start' },\n  filetypes = { 'bash', 'sh' }\n}\nvim.lsp.enable 'bashls'\n```\n\nFor Neovim 0.10 or lower with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)\n```lua\nrequire 'lspconfig'.bashls.setup {}\n```\n\n#### Oni\n\nOn the config file (`File -\u003e Preferences -\u003e Edit Oni config`) add the following configuration:\n\n```javascript\n\"language.bash.languageServer.command\": \"bash-language-server\",\n\"language.bash.languageServer.arguments\": [\"start\"],\n```\n\n#### Emacs\n\n[Lsp-mode](https://github.com/emacs-lsp/lsp-mode) has a built-in client, can be installed by `use-package`.\nAdd the configuration to your `.emacs.d/init.el`\n\n```emacs-lisp\n(use-package lsp-mode\n  :commands lsp\n  :hook\n  (sh-mode . lsp))\n```\n\nUsing the built-in `eglot` lsp mode:\n\n```emacs-lisp\n(use-package eglot\n  :config\n  (add-to-list 'eglot-server-programs '((sh-mode bash-ts-mode) . (\"bash-language-server\" \"start\")))\n\n  :hook\n  (sh-mode . eglot-ensure)\n  (bash-ts-mode . eglot-ensure))\n```\n\n## `shfmt` integration\n\nThe indentation used by `shfmt` is whatever has been configured for the current editor session, so\nthere is no `shfmt`-specific configuration variable for this. If your editor is configured for\ntwo-space indents then that's what it will use. If you're using tabs for indentation then `shfmt`\nwill use that.\n\nThe `shfmt` integration also supports configuration via `.editorconfig`. If any `shfmt`-specific\nconfiguration properties are found in `.editorconfig` then the config in `.editorconfig` will be\nused and the language server config will be ignored. This follows `shfmt`'s approach of using either\n`.editorconfig` or command line flags, but not both. Note that only `shfmt`-specific configuration\nproperties are read from `.editorconfig` - indentation preferences are still provided by the editor,\nso to format using the indentation specified in `.editorconfig` make sure your editor is also\nconfigured to read `.editorconfig`. It is possible to disable `.editorconfig` support and always use\nthe language server config by setting the \"Ignore Editorconfig\" configuration variable.\n\n## Logging\n\nThe minimum logging level for the server can be adjusted using the `BASH_IDE_LOG_LEVEL` environment variable\nand through the general [workspace configuration](https://github.com/bash-lsp/bash-language-server/blob/main/server/src/config.ts).\n\n## Development Guide\n\nPlease see [docs/development-guide][dev-guide] for more information.\n\n[tree-sitter]: https://github.com/tree-sitter/tree-sitter\n[tree-sitter-bash]: https://github.com/tree-sitter/tree-sitter-bash\n[vscode-marketplace]: https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode\n[dev-guide]: https://github.com/bash-lsp/bash-language-server/blob/master/docs/development-guide.md\n[ide-bash]: https://atom.io/packages/ide-bash\n[sublime-text-lsp]: https://packagecontrol.io/packages/LSP-bash\n[explainshell]: https://explainshell.com/\n[shellcheck]: https://www.shellcheck.net/\n[shfmt]: https://github.com/mvdan/sh#shfmt\n[languageclient-neovim]: https://github.com/autozimu/LanguageClient-neovim\n[nvim-lspconfig]: https://github.com/neovim/nvim-lspconfig\n[vim-lsp]: https://github.com/prabirshrestha/vim-lsp\n[vim-ale]: https://github.com/dense-analysis/ale\n[coc.nvim]: https://github.com/neoclide/coc.nvim\n[jupyterlab-lsp]: https://github.com/krassowski/jupyterlab-lsp\n","funding_links":[],"categories":["TypeScript","bash","Languages","Shell Script Development","Plugins / Themes / Dependencies"],"sub_categories":["Directory Navigation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbash-lsp%2Fbash-language-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbash-lsp%2Fbash-language-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbash-lsp%2Fbash-language-server/lists"}