rascal icon indicating copy to clipboard operation
rascal copied to clipboard

first line of string template does not indent injected lines.

Open jurgenvinju opened this issue 3 years ago • 1 comments

Describe the bug

rascal>aaa = "a\nb\nc";
str: "a\nb\nc"
rascal>"  <aaa>"
str: "  a\nb\nc"
rascal>
cancelled
rascal>"
>>>>>>>'   <aaa>"
str: "\n   a\n   b\n   c"
  • the interpolation on the second line works fine, it adds the two spaces in front of every line
  • the interpolation on the first line does nothing
  • of course the first line is different from the second line, because we parse the whitespace after the ' to know exactly which whitespace to use, while in the first line after the " anything goes.
  • fixing this requires some design decisions

jurgenvinju avatar Sep 05 '22 17:09 jurgenvinju

This is the workaround:

rascal>"
>>>>>>>'  <aaa>"[1..]
str: "  a\n  b\n  c"

jurgenvinju avatar Sep 05 '22 17:09 jurgenvinju