More then just highlighting when injecting bash

When I highlight script in another file, e.g., YAML, and inject BashSupport Pro, I get highlighting of the code but no other features. Not sure if this is possible or not, but I would greatly like to see this if it were possible.

Hey @ctwise,
code completion, rename, go to declaration, quick documentation, and similar features should be available.
ShellCheck and shfmt integration isn’t possible yet with injected code.
Is there a feature in particular, which isn’t working for you?

Code completion, go to and others are (currenly) limited to one fragment, i.e. if you have multiple fragments, then variables in the 2nd line won’t properly reference declarations in previous lines.

I am specially interested in shellcheck for embedded code. See this example:

  sudo tee "/etc/profile.d/sdkman.sh" <<EOF
#!/bin/sh
export SDKMAN_DIR="\${HOME}/.sdkman"
if [ -s "\${HOME}/.sdkman/bin/sdkman-init.sh" ]; then
  # shellcheck disable=SC1090
  . "\${HOME}/.sdkman/bin/sdkman-init.sh"
fi
EOF

I want shellcheck to the code that is inside EOF

Thanks @crramirez!
I’ll add that to the issues to investigate for 2.0.
It’s non-trivial, as the escaping of heredocs have to be handled before passing it to ShellCheck and when applying ShellCheck’s results. I can’t promise at this time that it’ll be implemented, but I’ll see what I can do .

Regards,
Joachim

I fixed ShellCheck support to at least show the messages for fragment editors. This will be part of the next 2.0 beta version.
With the next beta, you could open this with “Edit Shell Script fragment…” in the context menu of the injected fragment.

Afaik IntelliJ isn’t doing this for the inlined snippets in main editor to avoid slow highlighting due to slow external tools. It’s hopefully possible to do this in BashSupport Pro, but it has to be careful with performance of editor highlighting. I hope that ShellCheck in the fragment editor is a compromise for now.