Skip to content

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 11 Oct 12:04
· 363 commits to main since this release

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/#autoload files are detected as zsh.
  • Full zsh and ksh93 parsing: zsh syntax, from short and brace loops,
    repeat, foreach and { } always { } to anonymous functions with
    arguments, glob qualifiers and math functions, and ksh93's compound
    variables, types, namespace, .sh.math functions 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 own SL checks: untrusted input
    pasted into code run by eval, sh -c or source, 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 behind sudo, env, xargs and
    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
    .editorconfig the way shfmt does.
  • Quick fixes and refactorings: extract variable or function, inline
    variable, backticks to $(…), [ ] to [[ ]], if/elif to case, 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).