Worksheet, multiline strings, stripMargin - wrong content

Probably I'm missing something obvious, already hit this few times. Open worksheet and type

val k =
"""0
|1
|""".stripMargin
k.length

I get this:

k: String =
"0 //1
1 //2
"
res0: Int = 12

which is wrong. If I change "REPL" to "Plain" I get correct result:

k: String = 0
1

res0: Int = 4

 

Is this really how it should work? Isn't it a bug?

3
3 comments

I am able to reproduce on idea 2019.2 and later with a Scala plugin up to 2019.2.37. This issue was not previously there. That's a bug. Looks like somebody forgot to remove some debugging code before pushing into prod.

"Plain" mode does not work as I expect, it does not show me all the vals I defined for instance, so that's not really a workaround.

Please fix.

0

Reproduced on:

Scala plugin 2019.3.17

IntelliJ IDEA 2019.3 (Ultimate Edition)
Build #IU-193.5233.102, built on November 27, 2019

Runtime version: 1.8.0_222-release-1626-b3 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.6
GC: ParNew, ConcurrentMarkSweep
Memory: 1979M
Cores: 12
Registry:
Non-Bundled Plugins: Lombook Plugin, Pythonid, String Manipulation, com.intellij.kubernetes, org.intellij.scala, org.jetbrains.plugins.hocon

 

0

looks like there are few bug reports about it already https://youtrack.jetbrains.com/issue/SCL-15580

0

Please sign in to leave a comment.