Bash
Shell scripts are supported out of the box. The language is called Shell Script in Tyrn and covers .sh, .bash, .zsh and common dotfiles such as .bashrc and .zshrc. Files that start with a #! line for sh, bash, zsh or dash are detected too.
| Feature | Provided by |
|---|---|
| Language server | bash-language-server |
| Diagnostics | shellcheck, when installed |
Tyrn uses bash-language-server from your PATH if found, and otherwise installs it with Node.
Install shellcheck
bash-language-server relies on shellcheck for diagnostics. Without it you still get completions and navigation, but no warnings.
brew install shellcheckCheck it is on your path:
which shellcheckTo control which warnings you see, add a .shellcheckrc to your project or home folder. For example:
disable=SC2086See the ShellCheck wiki for the options.
Run a script
Open a .sh or .bash file and press cmd-shift-r. The script appears in the task list, tagged bash-script. To pass arguments, add a task:
[ { "label": "run my-script.sh with args", "command": "./my-script.sh", "args": ["--verbose", "--output=results.txt"], "tags": ["bash-script"] }]Tasks run in a login shell. See Tasks.
Settings
Set indentation for shell scripts:
{ "languages": { "Shell Script": { "tab_size": 2 } }}To treat other files as shell scripts:
{ "file_types": { "Shell Script": ["envrc.local", "scripts/*"] }}