Changelog of BashSupport Pro 1.5.8
New Features
General
- Support variables declared by the
select
command (go to declaration, rename, quick documentation, completion) - Support quick documentation for builtin variables in completion menus, e.g. when completing
$HOME
. - Documentation for built-in POSIX variables, e.g. for
$PATH
. Documentation of Bash variables will be added later. - Folding for subshell expressions, here documents, command groups, all compound commands, if command branches, case patterns, and all function definition bodies (including compound commands)
- Show code completions when typing out a shebang line.
- Support Markdown Navigator: automatically inject the BashSupport Pro shell script language into code blocks of the plugin. Language ids
bash
,sh
,zsh
,shell script
are supported. - Completion of relative file paths, e.g. for
. ./name
. Paths to command names are shown in the automatic popup, other locations need manual invocation to show the relative path completion. - Language injection into single-quoted strings, e.g.
'<html></html>'
. - Language injection into double-quoted strings, e.g.
"<html><body>$html</body></html>"
. Substituting elements like subshell commands are shown a read-only fragments when editing an editor on the injected content. - Improved language injection into heredocs with substitutions, e.g. subshell commands.
- Support the IntelliJ Rainbow Brackets plugin. You need version 6.11 or later of the rainbow plugin.
- Updated the bundled shfmt to the latest version.
ShellCheck
- New file-level directives are now inserted after the shebang, if it exists.
- Existing directives are updated instead of creating new ones. For example
# shellcheck disable=SC1234
is updated to# shellcheck disable=SC1234,SC2345
. - Don’t show a warning about an unknown shell types for files which have a supported extension, but no shebang line.
- Quickfix “Add source directive” for error
SC1008
(unrecognized shebang) - Quickfix “Add source directive” for error
SC2148
(missing shebang) - Quickfix “Add source directive” for error
SC1071
(unsupported shebang) - Show a tooltip with the short description for codes in ShellCheck directives. You can hover over any SC code in
# shellcheck
comments to see a short description. - Disabled SC1064 by default (
Expected a { to open the function definition.
), because BashSupport Pro treats compound commands as function bodies differently as ShellCheck. - Disabled SC1073 by default (
Couldn't parse this (thing). Fix to allow more checks.
), because it’s confusing in the editor and mixes with BashSupport Pro’s own error markers. - Display ShellCheck warnings without quick fixes similar to the normal presentation of inspections within the IDE.
- Display “Edit inspection settings…” menu item for the ShellCheck inspection warnings.
bats-core
- Updated bundled bats-core to the current 1.2.1 release. You can now use file-level setup and teardown functions.
- Support the
load
command, similar to thesource
builtin. Elements in referenced files are now parsed and used for quick doc, rename, etc. - Complete bats-core’s built-in variables.
- Quick documentation for the built-in bats-core variables.
- bats-core files are now validated by ShellCheck.
- Display in the run configuration editor, which working directory is used by default. By default, this is the source directory.
- Display in the run configuration editor, that the configured Bash interpreter is used by default if there’s no user-defined value of “interpreter path”.
- New option “Add interpreter dir to $PATH” to fix execution of bats-core on systems with incomplete $PATH settings. This is turned on by default.
- Show edit and create actions in the line markers of bats-core files (like everywhere else).
- Structure view now displays names of
@test
functions
File Support
- Files without an extension, but with a
# shellcheck source=name
directive in the first line, are now detected as shell scripts. - Automatically assign the shell script filetype to files without extension, which have a known shebang line. Both variants
/path/to/shell
and/usr/bin/env shell
are supported. Supported commands aresh
,bash
,bats
,zsh
,ash
,dash
,ksh
,ksh88
,ksh99
, andmksh
. Thedash
,ksh
, andmksh
shells are only supported as POSIX-compliant shells, for now. - Automatically assign the shell script filetype to files with extensions
.dash
,.ksh
and.mksh
. These files treated as POSIX shell files, for now. - IDEA-175757: Support
#! @SH@
and#! @SHELL@
shebang lines. - A file’s language (POSIX, Bash) is now detected by
# shellcheck shell=...
first, then by the shebang line, then by file extension. This improves completions and a bunch of other features, which rely on the language.
Run Configurations
- New Action “Send signal” in the left toolbar to send a signal to the running process. This is available for run and debug, on macOS and Linux.
- Renamed “Default interpreter for script” to “Automatic”.
- Configurations with interpreter type “Automatic” for executable files with a shebang line are now executed by your OS (Linux/macOS). This will give you the most compatible results.
- In Automatic mode, non-executable files are executed with the command in the shebang line.
- Windows: Allow to run executable files without an interpreter, e.g.
.bat
and.exe
files. - Windows: Don’t throw an exception trying to detect the version of WSL’s bash.exe when no distribution is installed.
- Support the new run configurations settings of the JetBrains Shell 2020.3 plugin (“run in terminal” and “environment variables”)
Debugger
- If the configured interpreter doesn’t seem to be Bash, then the default Bash interpreter is used. If there’s no default interpreter configured, then debugging is started and a warning is shown.
- Wait up to 30s (instead of 5s) for bashdb to become ready. For example, long timeouts can happen on Windows, when a virus scanner delays execution.
Inspections and Intentions
- New Inspection and quickfix to mark plain text files with known shebang line (e.g.
#!/bin/bash
) as shell script files. This helps to convert existing plain text files. - New inspection to show a warning for script files, which have a shebang line, but are not executable. This inspection is disabled by default.
- New inspection to show a warning for script files, which are executable, but have no shebang file. This inspection is disabled by default.
- Intention
To quoted string
now also allows to add quotes around plain words, e.g.a\ b
is turned into"a b"
. - New intention “Convert to unquoted”, which converts single-quoted or double-quoted strings into the equivalent form without quotes, e.g.
"hello world""
intohello\ world
. - New intention “Remove quotes” to remove the quotes of double-quoted or single-quoted strings.
- New intention to convert subshell commands into the equivalent backquote command, e.g.
(echo)
into`echo`
. - New intention to convert a backquote command substitution into the equivalent subshell command, e.g.
`echo`
into(echo)
. - New intention to convert a simple variable reference to the equivalent parameter expansion, e.g.
$name
to${name}
. - New intention to convert a simple parameter expansion to the equivalent variable reference, e.g.
${name}
to$name
.
Bugfixes
- macOS: The bundled
shfmt
andshellcheck
binaries are now signed and notarized. - Windows: Bundled
shfmt
,shellcheck
, and thepty4j
helpers are now signed. - Windows: Updated bundled binary of
shfmt
to avoid that it’s incorrectly flagged as malware. It’s now build with different compiler settings and without UPX compression. - Windows/Linux: Updated bundled binaries of ShellCheck to avoid that it’s incorrectly flagged as malware. UPX compression has been disabled.
- Run configurations: Show a better warning message for run configuration with interpreter type “Chosen by your OS” when the file is not executable.
- Windows: Fix execution of commands, which are to be found in
$PATH
, e.g.explorer.exe
. - Fixed rendering of HTML documentation comments.
- Fixed
AccessDeniedException
when completing paths, which are not readable by the current user. - Fixed inplace-rename for variables declared by
export
and other commands. - Fixed label in rename dialog for functions and variables declared by
export
and other commands. - Fixed handling of assignments, which only modify the environment of an executed command, e.g.
foo=value command_name
. Now these are never treated as valid variable declarations. - Fixed highlighting of the command name in
a=1 name arg
- JetBrains Markdown: Support more language aliases for language injection, including
sh
,shell
,shell-script
, andshell script
, IDEA-220660. - Disabled automatic formatting of parts of a file, as shfmt is currently not yet supporting this. This created too many undo steps and a few more issues.
- Live templates: re-enabled
if
,for
,fori
,select
,case
,while
,until
,function
. These templates are available where commands can be entered. - bats-core: ‘Run tests’ was sometimes displayed for directories, which did not contain .bats files.
- bats-core: Show live-templates
setup
,teardown
and@setup
only where commands are allowed. - shfmt: fix
AWT events are not allowed inside write action
- bats-core: fix
PsiInvalidElementAccessException
for.bats
files, which aren’t stored on disk. - Fix
StackOverflowException
with 2020.3 EAP (and possibly earlier versions)