Language Injection#
Noctule supports language injections in string literals to help you edit embedded code. Please refer to the JetBrains Help to learn how this feature works.
Language injections are available in plain strings and multi-line strings. Noctule takes care to escape special characters when you update the injected code with the fragment editor.
If you enable the bundled IntelliLang plugin,
then comments like // language=JSON are used to automatically infer the language to inject into the following string literal.
String Literals#
Language injection is available in string literals.
// language=JSON
let json = "{\"key\": \"value\"}"The same with escaped linebreaks:
// language=JSON
let json = "{\n \"key\": \"value\"\n}"Use extended string delimiters to avoid the escaping of double quotes and other special characters:
// language=JSON let json = #"{"key": "value"}"#
Multi-line String Literals#
Multi-line string literal can contain linebreaks and make embedded code more readable.
// language=JSON
let json = """
{
"key": "value"
}
"""If you invoke the fragment editor for the embedded code via Edit Fragment...,
then Noctule automatically takes care of the indentation.
The code inside the fragment editor will not show the indentation as it’s not part of the string value.