KT-13675 Ctrl-W: cannot select type argument in return type
#KT-13675 Fixed
This commit is contained in:
@@ -37,8 +37,10 @@ class KotlinTypeSelectioner : ExtendWordSelectionHandlerBase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>? {
|
override fun select(e: PsiElement, editorText: CharSequence, cursorOffset: Int, editor: Editor): List<TextRange>? {
|
||||||
if (e.getStrictParentOfType<KtObjectDeclaration>() != null) return null
|
if (e !is KtTypeReference) return null
|
||||||
val colonPosition = e.getStrictParentOfType<KtCallableDeclaration>()?.colon?.startOffset ?: 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))
|
return listOf(TextRange(colonPosition, e.endOffset))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun f(): List<AAA<caret>>{}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun f(): List<<selection>AAA<caret></selection>>{}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun f(): List<selection><AAA<caret>></selection>{}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun f(): <selection>List<AAA<caret>></selection>{}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
fun f()<selection>: List<AAA<caret>></selection>{}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
<selection>fun f(): List<AAA<caret>>{}</selection>
|
||||||
@@ -96,6 +96,10 @@ public class WordSelectionTest extends KotlinLightCodeInsightFixtureTestCase {
|
|||||||
doTest();
|
doTest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testKT13675() {
|
||||||
|
doTest();
|
||||||
|
}
|
||||||
|
|
||||||
private void doTest() {
|
private void doTest() {
|
||||||
String dirName = getTestName(false);
|
String dirName = getTestName(false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user