Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 11 Oct 18:16
· 190 commits to main since this release

shell-lsp 0.4.0 is about understanding and steering the linter from the
editor: diagnostics explain themselves on hover, you can see which shell a
file is linted as and switch it, choose how strict linting is with one
setting, and fix or ignore a check across a file or the whole workspace.

Highlights

  • Diagnostics explain themselves: hovering a finding shows its severity,
    a one-line summary, a before/after preview of its fix marked safe or for
    review, how to silence it, and links to its entry in
    docs/checks.md
    or docs/rules.md
    and the ShellCheck wiki. Diagnostic codes link to those docs in editors
    that support it.
  • See and switch the shell: VS Code's status bar shows the shell a file is
    linted as and what decided it ("from the shebang #!/usr/bin/env bash",
    "guessed from the .sh extension"). Clicking it switches the shell by
    writing a # shellcheck shell= directive, which every editor and
    shell-lsp check honour. Other editors can ask the server through the new
    shellLsp/documentDialect and shellLsp/setDialect requests; a Neovim
    statusline snippet is in
    docs/editors.md.
  • lint.profile: minimal keeps errors, warnings and the notes that
    point at real bugs; recommended (the default) is unchanged; strict
    turns on the optional checks. shell-lsp check --profile does the same.
    Explicit lint.exclude, lint.optional and directives still win.
  • Per-check actions on a diagnostic: fix every finding of that check in
    the file, ignore it in the file (merged into the header's disable=
    line), or ignore it in the workspace (added to the nearest
    .shellcheckrc, created at the folder root if needed, after
    confirmation).

Changes

  • The editor now applies the nearest .shellcheckrc (including
    ~/.shellcheckrc and $XDG_CONFIG_HOME/shellcheckrc) the way
    shell-lsp check does: its disable, enable and extended-analysis
    settings affect diagnostics, a broken file is reported by name, and edits
    to it are picked up. Its shell= and source-path= are still read only by
    the command line.
  • A new # shellcheck shell= line is inserted after the existing header
    directives instead of directly after the shebang.
  • VS Code's generic shellscript language no longer counts as naming the
    shell, so a file without a shebang is shown as a guess.

Install

Release binaries for Linux, macOS and Windows (amd64, arm64) with
SHA256SUMS are attached below. Alternatively
go install github.com/stubbedev/shell-lsp@v0.4.0 or
nix profile install github:stubbedev/shell-lsp. For VS Code, install the
Shell LSP extension, or shell-lsp-0.4.0.vsix below. Editor setup:
docs/editors.md.

Known limitations

  • .shellcheckrc files get no completion or hover, because editors do not
    send them to language servers.