IDE (IntelliJ IDEA) support for Raw String Literals

Kevin Bourrillion kevinb at
Thu May 3 14:31:33 UTC 2018

Hi Anna,

I have a couple other requests for IntelliJ's behavior with raw string
literals. It would be helpful for me if I could get some sense of how
likely these features would be to be implemented.

The requests apply to either of these cases:

   - Case 1: If we decide to implement automatic stripIndent behavior for
   - Case 2: If we decide not to, but for the particular string literal in
   question, IntelliJ recognizes that stripIndent is being called.

In either of these cases,

   - Will IntelliJ automatically maintain the leading indentation inside
   the RSL in the same way it handles leading indentation outside it?
      - Of course, there is an issue in "Case 2" that when you are first
      typing you won't have *typed* stripIndent yet, so it won't know
      whether you are planning to. There could be a user preference that
      automatically inserts `.stripindent() at the end when you type the
      opening delimiter; that would help.
   - Could IntelliJ compute the region of the source file that will be
   included in the resulting runtime constant, and render that boundary
   visually on the screen (either as a border, or a different shading for the
   - When the user is highlighting text, as long as the endpoints are both
   within the delimiters, can the highlighted region be automatically
   restricted to that boundary? That is, exclude whitespace that is recognized
   as indentation that will be stripped. This would make pasting raw text to a
   different file much cleaner/easier.


On Fri, Apr 20, 2018 at 9:36 AM, Anna Kozlova <anna.kozlova at>

> Hi guys,
> we started developing the support for raw literals and would like to ask
> what do you think.
> Given a string `a<caret>b` and press ` at <caret>, what is the expected
> behavior?
> 1. Just insert tick: result is `a`b` where it would be parsed as raw
> literal (`a`), unknown identifier (b) and new raw literal till the end of
> file. Second ` at the same position will fix parsing. If one tick was
> intended, one would need to call an intention to fix the number of quotes
> around initial raw literal.
> 2. Add additional quotes around initial raw literal: result is ``a`b``.
> Literal is valid but to get `a` + `b` expression, one need to go to the
> string start/end and change the number of ticks or call an intention.
> It looks like to me that (1) would be needed more often, like each time
> when one needs to dynamically compose a string. (2) is more about injected
> code in the raw strings which IDE could treat differently anyway. (It's
> possible to create an IDE switcher between these strategies but still the
> default value would be needed.) I would love to see other use cases as
> well.
> Thank you,
> Anna

Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at

More information about the amber-dev mailing list