diff --git a/idea/src/org/jetbrains/jet/plugin/codeInsight/CodeInsightUtils.java b/idea/src/org/jetbrains/jet/plugin/codeInsight/CodeInsightUtils.java index 70c5ed11b2e..54c3f66f5a9 100644 --- a/idea/src/org/jetbrains/jet/plugin/codeInsight/CodeInsightUtils.java +++ b/idea/src/org/jetbrains/jet/plugin/codeInsight/CodeInsightUtils.java @@ -210,7 +210,7 @@ public class CodeInsightUtils { public static PsiElement getTopmostElementAtOffset(@NotNull PsiElement element, int offset) { do { PsiElement parent = element.getParent(); - if (parent == null || (parent.getTextOffset() < offset)) { + if (parent == null || (parent.getTextOffset() < offset) || parent instanceof JetBlockExpression) { break; } element = parent; diff --git a/idea/testData/debugger/tinyApp/outs/insertInBlock.out b/idea/testData/debugger/tinyApp/outs/insertInBlock.out new file mode 100644 index 00000000000..6936cb0ff92 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/insertInBlock.out @@ -0,0 +1,7 @@ +LineBreakpoint created at insertInBlock.kt:6 +!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!RT_JAR! insertInBlock.InsertInBlockPackage +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +insertInBlock.kt:5 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/evaluate/insertInBlock.kt b/idea/testData/debugger/tinyApp/src/evaluate/insertInBlock.kt new file mode 100644 index 00000000000..880f9fbb09b --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/evaluate/insertInBlock.kt @@ -0,0 +1,11 @@ +package insertInBlock + +fun main(args: Array) { + val lambda = { + //Breakpoint! + val a = 1 + }() +} + +// EXPRESSION: 1 + 1 +// RESULT: 2: I \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java index 2c6c127315c..73973e98407 100644 --- a/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/debugger/evaluate/KotlinEvaluateExpressionTestGenerated.java @@ -96,6 +96,11 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat doTest("idea/testData/debugger/tinyApp/src/evaluate/imports.kt"); } + @TestMetadata("insertInBlock.kt") + public void testInsertInBlock() throws Exception { + doTest("idea/testData/debugger/tinyApp/src/evaluate/insertInBlock.kt"); + } + @TestMetadata("multilineExpressionAtBreakpoint.kt") public void testMultilineExpressionAtBreakpoint() throws Exception { doTest("idea/testData/debugger/tinyApp/src/evaluate/multilineExpressionAtBreakpoint.kt");