KT-13675 Ctrl-W: cannot select type argument in return type

#KT-13675 Fixed
This commit is contained in:
Valentin Kipyatkov
2016-09-07 20:02:50 +03:00
parent 73828d1411
commit 36c2b01047
8 changed files with 14 additions and 2 deletions
@@ -37,8 +37,10 @@ class KotlinTypeSelectioner : ExtendWordSelectionHandlerBase() {
}
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>? {
if (e.getStrictParentOfType<KtObjectDeclaration>() != null) return null
val colonPosition = e.getStrictParentOfType<KtCallableDeclaration>()?.colon?.startOffset ?: return null
if (e !is KtTypeReference) return null
val callableDeclaration = e.parent as? KtCallableDeclaration ?: return null
if (e != callableDeclaration.typeReference) return null
val colonPosition = callableDeclaration.colon?.startOffset ?: return null
return listOf(TextRange(colonPosition, e.endOffset))
}
}
+1
View File
@@ -0,0 +1 @@
fun f(): List<AAA<caret>>{}
+1
View File
@@ -0,0 +1 @@
fun f(): List<<selection>AAA<caret></selection>>{}
+1
View File
@@ -0,0 +1 @@
fun f(): List<selection><AAA<caret>></selection>{}
+1
View File
@@ -0,0 +1 @@
fun f(): <selection>List<AAA<caret>></selection>{}
+1
View File
@@ -0,0 +1 @@
fun f()<selection>: List<AAA<caret>></selection>{}
+1
View File
@@ -0,0 +1 @@
<selection>fun f(): List<AAA<caret>>{}</selection>
@@ -96,6 +96,10 @@ public class WordSelectionTest extends KotlinLightCodeInsightFixtureTestCase {
doTest();
}
public void testKT13675() {
doTest();
}
private void doTest() {
String dirName = getTestName(false);