IDE (IntelliJ IDEA) support for Raw String Literals

Anna Kozlova anna.kozlova at jetbrains.com
Fri Apr 20 16:36:55 UTC 2018


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


More information about the amber-dev mailing list