Complete statment for function call: fix wrong right parenthesis place (KT-31595)
#KT-31595 Fixed
This commit is contained in:
committed by
Nikolay Krasko
parent
bd661fcf82
commit
9b04af9968
@@ -32,7 +32,7 @@ class KotlinValueArgumentListFixer : SmartEnterProcessorWithFixers.Fixer<KotlinS
|
||||
editor.caretModel.moveToOffset(offset + 1)
|
||||
}
|
||||
} else {
|
||||
val offset = element.endOffset
|
||||
val offset = lastArgument?.endOffset ?: element.endOffset
|
||||
editor.document.insertString(offset, ")")
|
||||
editor.caretModel.moveToOffset(offset + 1)
|
||||
}
|
||||
|
||||
@@ -1483,6 +1483,39 @@ class SmartEnterTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
"""
|
||||
)
|
||||
|
||||
fun testValueArgumentList6() = doFileTest(
|
||||
"""
|
||||
fun foo(s: String) = 1
|
||||
fun test() {
|
||||
foo(""<caret>
|
||||
val aValue = ""
|
||||
}
|
||||
""",
|
||||
"""
|
||||
fun foo(s: String) = 1
|
||||
fun test() {
|
||||
foo("")<caret>
|
||||
val aValue = ""
|
||||
}
|
||||
"""
|
||||
)
|
||||
|
||||
fun testValueArgumentList7() = doFileTest(
|
||||
"""
|
||||
fun test() {
|
||||
String.to("123"<caret>
|
||||
val aValue = ""
|
||||
}
|
||||
""",
|
||||
"""
|
||||
fun test() {
|
||||
String.to("123")
|
||||
<caret>
|
||||
val aValue = ""
|
||||
}
|
||||
"""
|
||||
)
|
||||
|
||||
fun doFunTest(before: String, after: String) {
|
||||
fun String.withFunContext(): String {
|
||||
val bodyText = "//----\n${this.trimIndent()}\n//----"
|
||||
|
||||
Reference in New Issue
Block a user