This PR introduces native LSP support for Bash by integrating `bash-language-server`. Combined with the existing Tree-sitter grammar, Zed now provides a complete, out-of-the-box development experience for shell scripting. The implementation is very similar to other npm-managed language servers. With `shellcheck` installed, standard LSP features—including diagnostics, code actions, go-to-definition, find-references, and code completion—work as expected. Since I am not a frequent user of Bash, I have intentionally limited this implementation to a standard, "out-of-the-box" setup. I lack the hands-on experience to identify specific pain points or advanced LSP features that might require custom integration, so I've avoided adding any speculative or specialized configurations, especially within the `LspAdapter` trait. Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #51917 Release Notes: - Added built-in language server support for Bash --------- Co-authored-by: Finn Evers <finn@zed.dev>
1.4 KiB
1.4 KiB
title, description
| title | description |
|---|---|
| Bash | Configure Bash language support in Zed, including language servers, formatting, and debugging. |
Bash
Bash support is available natively in Zed.
- Tree-sitter: tree-sitter/tree-sitter-bash
- Language Server: bash-lsp/bash-language-server
Configuration
It is highly recommended to install shellcheck, as bash-language-server depends on it to provide diagnostics.
Install shellcheck:
brew install shellcheck # macOS (HomeBrew)
apt-get install shellcheck # Ubuntu/Debian
pacman -S shellcheck # ArchLinux
dnf install shellcheck # Fedora
yum install shellcheck # CentOS/RHEL
zypper install shellcheck # openSUSE
choco install shellcheck # Windows (Chocolatey)
And verify it is available from your path:
which shellcheck
shellcheck --version
If you wish to customize the warnings/errors reported you just need to create a .shellcheckrc file. You can do this in the root of your project or in your home directory (~/.shellcheckrc). See: shellcheck documentation for more.