The language injection feature of your IDE lets you define that some content of your script is written in another language. BashSupport Pro comes with full support for language injections.
There are two ways to define which language is injected.
- Alt & Enter → Inject language or reference : This intention lets you define the injected language temporarily.
# language=comments: Content of elements, which follow such a comment, is automatically highlighted with the given language. Commonly used languages are HTML, XML, Java, or JSON. Try file extensions like
kt, if you don’t know which ID to use here.
The editor window, which only displays the injected content, is called a fragment editor.
Language Injection Into Strings
Strings support escaping. Escaped characters are unescaped in the fragment editor, e.g.
\$HOME is shown as
` will insert the escaped characters
\`. This way you don’t need to care about Bash’s escaping rules when you’re working in the fragment editor.
Strings support embedded subshell commands and other substitutions. These sections of the string are displayed as read-only in the fragment editor. Otherwise it wouldn’t be possible to enter the equivalent of
\$HOME=$HOME in the fragment editor.
Language Injection Into Raw Strings
Content in raw strings is displayed as is. There’s no escaping, except for the single quote
Single quotes can only be escaped within
BashSupport Pro automatically changes
$'' when you enter the first single quote character in the fragment editor.
Injection Into Here Documents
Here documents with plain, unquoted markers support subshell commands and other substitutions. BashSupport Pro displays these sections as read–only in the same way as for strings. Escaping is supported, too.
Here document with quoted markers, e.g.
"EOF", don’t support substitutions. Therefore escape code handling is not needed in this context.