Fixed selection in case of empty class body
#KT-30597 Fixed
This commit is contained in:
+4
-1
@@ -24,7 +24,10 @@ class KotlinClassMemberSelectioner : ExtendWordSelectionHandlerBase() {
|
|||||||
val lastChild = parent.lastChild ?: return null
|
val lastChild = parent.lastChild ?: return null
|
||||||
val startElement = firstChild.getNextSiblingIgnoringWhitespace() ?: firstChild
|
val startElement = firstChild.getNextSiblingIgnoringWhitespace() ?: firstChild
|
||||||
val endElement = lastChild.getPrevSiblingIgnoringWhitespace() ?: lastChild
|
val endElement = lastChild.getPrevSiblingIgnoringWhitespace() ?: lastChild
|
||||||
val textRange = TextRange(startElement.textRange.startOffset, endElement.textRange.endOffset)
|
val startOffset = startElement.textRange.startOffset
|
||||||
|
val endOffset = endElement.textRange.endOffset
|
||||||
|
if (startOffset >= endOffset) return null
|
||||||
|
val textRange = TextRange(startOffset, endOffset)
|
||||||
return expandToWholeLinesWithBlanks(editorText, textRange)
|
return expandToWholeLinesWithBlanks(editorText, textRange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
class SimpleClass {
|
||||||
|
<caret>
|
||||||
|
}
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
class SimpleClass <selection>{
|
||||||
|
<caret>
|
||||||
|
}</selection>
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
<selection>class SimpleClass {
|
||||||
|
<caret>
|
||||||
|
}</selection>
|
||||||
@@ -112,6 +112,10 @@ public class WordSelectionTest extends KotlinLightCodeInsightFixtureTestCase {
|
|||||||
doTest();
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testClass() {
|
||||||
|
doTest();
|
||||||
|
}
|
||||||
|
|
||||||
public void testDeclarationWithComment1() { doTest(); }
|
public void testDeclarationWithComment1() { doTest(); }
|
||||||
public void testDeclarationWithComment2() { doTest(); }
|
public void testDeclarationWithComment2() { doTest(); }
|
||||||
public void testDeclarationWithComment3() { doTest(); }
|
public void testDeclarationWithComment3() { doTest(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user