Repository navigation
v0.1.0
The first release of shell-lsp: a language server for bash, zsh, POSIX sh,
dash, ksh and busybox sh in a single static binary with no runtime
dependencies. The linter, the formatter, the manual-page reader and the
.editorconfig reader are all built in.
Highlights
- zsh is linted by zsh's rules: no bash word-splitting or globbing
warnings where zsh does neither, zsh's own parameters and hook arrays are
known, glob qualifiers, parameter flags and subscript flags are
understood, and#compdef/#autoloadfiles are detected as zsh. - Full zsh and ksh93 parsing: zsh syntax, from short and brace loops,
repeat,foreachand{ } always { }to anonymous functions with
arguments, glob qualifiers and math functions, and ksh93's compound
variables, types,namespace,.sh.mathfunctions and seek redirections
parse into a full syntax tree instead of syntax errors, through a patched
fork of mvdan.cc/sh whose patches are kept ready for upstream
(#23). - Native linter that reuses ShellCheck's check codes and directives, lints
zsh, follows sourced files, and adds its ownSLchecks: untrusted input
pasted into code run byeval,sh -corsource, opt-in arithmetic
injection, functions a script never calls, and syntax and regex errors in
embedded awk, sed and jq programs (docs/rules.md). - Completion and hover for builtins, keywords, functions, variables and
paths, plus the options and (nested) subcommands of installed commands, read
natively from their manual pages, also behindsudo,env,xargsand
similar wrappers. - Sourced files act as imports: their functions and globals complete,
hover, navigate and are followed by the linter; open buffers win over disk. - Navigation: definition, references, rename, call hierarchy, document
and workspace symbols, highlights, links, selection ranges, folding. - Editing aids: semantic tokens (including inside awk, sed and jq
programs), inlay hints, signature help, code lenses. - Formatting with the printer shfmt is built on, honouring
.editorconfigthe way shfmt does. - Quick fixes and refactorings: extract variable or function, inline
variable, backticks to$(…),[ ]to[[ ]], if/elif tocase, toggle
function, add strict mode, move a function into a sourced file, and a
fix-all source action. - Bats: tests in the outline, "Run file" and "Run test" lenses that run the
project's bats and turn failures into diagnostics that follow their test. - Fast: whole-file lint of 10k lines in tens of milliseconds, parallel
workspace indexing, single-flight caching per document version.
Install
Release binaries for Linux and macOS (amd64, arm64) with SHA256SUMS are
attached below. Alternatively go install github.com/stubbedev/shell-lsp@v0.1.0
or nix profile install github:stubbedev/shell-lsp. For VS Code, install
the Shell LSP extension, shell-lsp-0.1.0.vsix below, which can also
download the server for you. Editor setup:
docs/editors.md.
Known limitations
- Windows is not supported yet (#31).