I'm currently migrating a codebase that used a lot...
# language-evolution
c
I'm currently migrating a codebase that used a lot of dollars in string literals to using multi-string literals, and while the language feature itself is great, the tooling support… could be improved. Let's take this snippet:
Copy code
val foo = "\$foo"   // Warning: add interpolation prefix
println("""
	foo: $foo
""".trimIndent())
Let's follow the warning. We get:
Copy code
val foo = $$"$foo"
println("""
	foo: $foo
""".trimIndent())
So far, so good. But now, the variable is pointless. Let's inline it, we get:
Copy code
println("""
	foo: $foo       // doesn't compile
""".trimIndent())
Sometimes, it does actually inline it into:
Copy code
println("""
	foo: ${$$"$foo"}
""".trimIndent())
which was probably not the intent behind the KEEP. There is no inspection there to add an interpolation prefix. There is also no inspection for:
Copy code
println("""
    foo: ${"\$foo"}
""".trimIndent())
Code highlighting frequently gets it wrong (e.g. see attached screenshot). In the end, I'm pretty much did the entire migration manually. Especially now that the team is proposing changing existing syntax in every other KEEP, I'm worried that tooling is being left off as an afterthought.
b
The IDEA plugin team has been pretty on top of tackling issues like these in my experience, and because I'm the kind of person who cuts themself on the bleeding edge. It looks like they're aware of some of these issues. Definitely wouldn't hurt to throw in more edge cases as you run into them
c
Also,
Copy code
$$"""<cursor>
followed by ENTER does not insert the
.trimIndent()
and does not indent correctly
To be clear, I didn't create this thread because there's one or two things missing. I created this thread because the language design team is planning multiple syntax changes to the language, and they must work alongside the tooling teams, otherwise the dev experience will be worse with the features than without them.
plus1 1
👍 1