KT-6582 "Expand selection" in string literal should select word in string

#KT-6582 fixed
This commit is contained in:
Evgeny Gerashchenko
2015-01-22 17:35:53 +03:00
parent 0159f95111
commit 6ffe49f1d2
9 changed files with 17 additions and 3 deletions
@@ -32,7 +32,7 @@ public class KotlinWordSelectionFilter : Condition<PsiElement>{
if (e.getParent().getFirstChild().getNextSibling() == null && e.getParent() !is JetContainerNode) return false // skip nodes with the same range as their parent
return when (e.getNode().getElementType()) {
BLOCK, LITERAL_STRING_TEMPLATE_ENTRY, KDocElementTypes.KDOC_SECTION -> false
BLOCK, KDocElementTypes.KDOC_SECTION -> false
else -> true
}
}
@@ -0,0 +1,3 @@
fun main(args: Array<String>) {
println("<caret>foo bar")
}
@@ -0,0 +1,3 @@
fun main(args: Array<String>) {
println("<selection><caret>foo</selection> bar")
}
@@ -0,0 +1,3 @@
fun main(args: Array<String>) {
println("<selection><caret>foo bar</selection>")
}
@@ -0,0 +1,3 @@
fun main(args: Array<String>) {
println(<selection>"<caret>foo bar"</selection>)
}
@@ -1 +1 @@
val v = "<selection>aaa $x <caret>bbb</selection>"
val v = "aaa $x<selection> <caret>bbb</selection>"
@@ -1 +1 @@
val v = <selection>"aaa $x <caret>bbb"</selection>
val v = "<selection>aaa $x <caret>bbb</selection>"
@@ -0,0 +1 @@
val v = <selection>"aaa $x <caret>bbb"</selection>
@@ -50,6 +50,7 @@ public class WordSelectionTest extends JetLightCodeInsightFixtureTestCase {
public void testCommentForStatements() { doTest(); }
public void testSimpleStringLiteral() { doTest(); }
public void testSimpleStringLiteral2() { doTest(); }
public void testTemplateStringLiteral1() { doTest(); }
public void testTemplateStringLiteral2() { doTest(); }