Injecting language to raw string with margin

When I use language injection to strings, it works fine for both string literals and raw strings. However, if I use margin prefixes (and trimMargin() function) with the raw string, the injected language reports unresolved character in that injected language dialect.
I know that it’s impossible to guarantee that the margin prefix is used just as margin prefix (as it may have complex flow, such as passing the string somewhere else and trim the margin there) but I think it would be nice for the compiler to let the job done for much simpler cases, so that the code below runs with no problems…
val jsonString = """
| "a": false,
| "b": 2

I would suspect that it would not be easy to implement and that it would find very little use. (But I don’t know and, of course, JetBrains gets to decide.)

For me, it works well enough to use trimIndent() instead, which does not require the “margin” character.


I second that. Just use trimIndent. Using | is strange idea in the first place.

For reference, the feature request is tracked here: