Enable auto-indent in multiline strings when caret is before interpolation
#KT-17849 Fixed
This commit is contained in:
@@ -273,7 +273,7 @@ class KotlinMultilineStringEnterHandler : EnterHandlerDelegateAdapter() {
|
|||||||
KtTokens.REGULAR_STRING_PART -> {
|
KtTokens.REGULAR_STRING_PART -> {
|
||||||
// Ok
|
// Ok
|
||||||
}
|
}
|
||||||
KtTokens.CLOSING_QUOTE -> {
|
KtTokens.CLOSING_QUOTE, KtTokens.SHORT_TEMPLATE_ENTRY_START, KtTokens.LONG_TEMPLATE_ENTRY_START -> {
|
||||||
if (element.startOffset != offset) {
|
if (element.startOffset != offset) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
val className = 1
|
||||||
|
val test = """<caret>${className}"""
|
||||||
|
//-----
|
||||||
|
val className = 1
|
||||||
|
val test = """
|
||||||
|
<caret>${className}""".trimIndent()
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
val className = 1
|
||||||
|
val test = """<caret>$className"""
|
||||||
|
//-----
|
||||||
|
val className = 1
|
||||||
|
val test = """
|
||||||
|
<caret>$className""".trimIndent()
|
||||||
@@ -104,12 +104,24 @@ public class MultiLineStringIndentTestGenerated extends AbstractMultiLineStringI
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("enterBeforeLongEntryOneLine.kt")
|
||||||
|
public void testEnterBeforeLongEntryOneLine() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/enterHandler/multilineString/spaces/enterBeforeLongEntryOneLine.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("enterBeforeMarginChar.kt")
|
@TestMetadata("enterBeforeMarginChar.kt")
|
||||||
public void testEnterBeforeMarginChar() throws Exception {
|
public void testEnterBeforeMarginChar() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/enterHandler/multilineString/spaces/enterBeforeMarginChar.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/enterHandler/multilineString/spaces/enterBeforeMarginChar.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("enterBeforeShortEntryOneLine.kt")
|
||||||
|
public void testEnterBeforeShortEntryOneLine() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/enterHandler/multilineString/spaces/enterBeforeShortEntryOneLine.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("enterInInfixMargin.kt")
|
@TestMetadata("enterInInfixMargin.kt")
|
||||||
public void testEnterInInfixMargin() throws Exception {
|
public void testEnterInInfixMargin() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/enterHandler/multilineString/spaces/enterInInfixMargin.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/editor/enterHandler/multilineString/spaces/enterInInfixMargin.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user