2 Intentions for string templates:
the first removes curly braces from a simple name variable, ${x} -> $x
and the second does the opposite $x -> ${x}
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "<caret>hello"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$<caret>x"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "${x}"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "something$<caret>x.somethingelse"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "something${x}.somethingelse"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$<caret>x\n"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "${x}\n"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$x$<caret>x$x"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$x${x}$x"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = """$x$<caret>x$x"""
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = """$x${x}$x"""
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo() {
|
||||
val x = "x"
|
||||
val y = "$<caret>{x.length}"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo() {
|
||||
val x = X()
|
||||
val y = "$<caret>{x.bar()}"
|
||||
}
|
||||
|
||||
public class X() {
|
||||
fun bar() : String = "bar"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo() {
|
||||
val x = 3
|
||||
val z = 4
|
||||
val y = "$<caret>{x + z}"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo() {
|
||||
val x = 3
|
||||
val y = "$<caret>{x}y"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: false
|
||||
fun foo() {
|
||||
val x = 3
|
||||
val y = "$<caret>{x}_y"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$<caret>{x}"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$x"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$<caret>{x}.moretext"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$<caret>x.moretext"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$<caret>{x}\n"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$x\n"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$<caret>{x}() this is okay, x will not be thought of as a function call"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "$x() this is okay, x will not be thought of as a function call"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "text$<caret>{x} moretext"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = "text$x moretext"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = """text$<caret>{x} moretext"""
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
// IS_APPLICABLE: true
|
||||
fun foo() {
|
||||
val x = 4
|
||||
val y = """text$x moretext"""
|
||||
}
|
||||
Reference in New Issue
Block a user