Fix NoSuchElementException editing script file
^KT-30440 Fixed
This commit is contained in:
+2
-1
@@ -152,7 +152,8 @@ class KotlinCodeBlockModificationListener(
|
||||
|
||||
is KtScriptInitializer -> {
|
||||
return (blockDeclaration.body as? KtCallExpression)
|
||||
?.lambdaArguments?.last()
|
||||
?.lambdaArguments
|
||||
?.lastOrNull()
|
||||
?.getLambdaExpression()
|
||||
?.takeIf { it.isAncestor(element) }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// TRUE
|
||||
|
||||
fun foo() = 1
|
||||
|
||||
foo(<caret>)
|
||||
|
||||
// SKIP_ANALYZE_CHECK
|
||||
+5
@@ -224,6 +224,11 @@ public class OutOfBlockModificationTestGenerated extends AbstractOutOfBlockModif
|
||||
runTest("idea/testData/codeInsight/outOfBlock/scriptInLambdaExpression.kts");
|
||||
}
|
||||
|
||||
@TestMetadata("scriptTopLevelCallExpression.kts")
|
||||
public void testScriptTopLevelCallExpression() throws Exception {
|
||||
runTest("idea/testData/codeInsight/outOfBlock/scriptTopLevelCallExpression.kts");
|
||||
}
|
||||
|
||||
@TestMetadata("scriptTopLevelExpression.kts")
|
||||
public void testScriptTopLevelExpression() throws Exception {
|
||||
runTest("idea/testData/codeInsight/outOfBlock/scriptTopLevelExpression.kts");
|
||||
|
||||
Reference in New Issue
Block a user