Skip to content

shell-lsp

One language server for shell and every language that embeds it

  • bash
  • zsh
  • POSIX sh
  • dash
  • ksh
  • justfile
  • Makefile
  • Dockerfile
  • Nix
A bash script with findings and inlay hints, and a hover that explains an unquoted command substitution and previews the fix

A finding in a bash script, with a hover that explains it and previews the fix.

Patterns explained

Hover takes the shell's own patterns apart and, when the values are known, computes the result.

See the example
Hover on a zsh substitution listing each part of the pattern, the groups captured into $match, and the result 1:a 2:b

Completion from the manual pages

Flags and subcommands of installed commands come from their manual pages, read without man.

Completion and hover
Completion after git switch -- listing its flags, with the manual page's description of --discard-changes

A script inside a Nix string

A writeShellScript string is read as shell with no marker, and findings land on the line of the .nix file.

See the example
A shell finding inside a writeShellScript string in a Nix file, with a hover that explains it and previews the fix

From a jq variable to the Nix binding behind it

Peek definition on a jq variable lists the jq flag, the shell variable and the Nix binding.

See the example
Peek definition on a jq variable listing the jq flag, the shell variable and the Nix binding

The same findings on the command line

The check command reports what the editor shows, for every language at once.

Command line
The check command in a terminal, reporting findings in a Nix file and a shell script with colours and links
0.18 s
To lint the 1,219 shell scripts of nixpkgs, where one shellcheck process takes 20.7 s
95 MiB
Peak memory on an 89-file flake, where nixd uses 576 MiB
4,716
Scripts in the pinned corpus that CI holds the linter to ShellCheck over
0
Formatter differences from nixfmt 1.5.0 across all 44,765 files of nixpkgs