add word selection step for selecting a type parameter or type argument list with enclosing brackets

#KT-6697 Fixed
This commit is contained in:
Dmitry Jemerov
2015-07-29 19:58:55 +02:00
parent 77caa0d644
commit e545a7c699
5 changed files with 14 additions and 4 deletions
@@ -39,6 +39,11 @@ public class KotlinListSelectioner : ExtendWordSelectionHandlerBase() {
val node = e.getNode()!!
val startNode = node.findChildByType(TokenSet.create(JetTokens.LPAR, JetTokens.LT)) ?: return null
val endNode = node.findChildByType(TokenSet.create(JetTokens.RPAR, JetTokens.GT)) ?: return null
return listOf(TextRange(startNode.getStartOffset() + 1, endNode.getStartOffset()))
val innerRange = TextRange(startNode.getStartOffset() + 1, endNode.getStartOffset())
if (e is JetTypeArgumentList || e is JetTypeParameterList) {
return listOf(innerRange,
TextRange(startNode.getStartOffset(), endNode.getStartOffset() + endNode.getTextLength()))
}
return listOf(innerRange)
}
}
+1 -1
View File
@@ -1,3 +1,3 @@
fun <A, B> foo() {
<selection>foo<I<caret>nt, B>()</selection>
foo<selection><I<caret>nt, B></selection>()
}
+3
View File
@@ -0,0 +1,3 @@
fun <A, B> foo() {
<selection>foo<I<caret>nt, B>()</selection>
}
+1 -2
View File
@@ -1,3 +1,2 @@
<selection>fun <A, <caret>B> foo() {
fun <selection><A, <caret>B></selection> foo() {
}
</selection>
+3
View File
@@ -0,0 +1,3 @@
<selection>fun <A, <caret>B> foo() {
}
</selection>