Fix useless "Remove curly braces" before Chinese character

So #KT-20409 Fixed
This commit is contained in:
Toshiaki Kameyama
2017-10-02 05:11:29 +03:00
committed by Mikhail Glukhikh
parent 912ddfcb2b
commit 2121322665
8 changed files with 40 additions and 1 deletions
@@ -460,7 +460,7 @@ fun KtExpression.getOutermostParenthesizerOrThis(): KtExpression {
fun PsiElement.isFunctionalExpression(): Boolean = this is KtNamedFunction && nameIdentifier == null
private val BAD_NEIGHBOUR_FOR_SIMPLE_TEMPLATE_ENTRY_PATTERN = Regex("[a-zA-Z0-9_].*")
private val BAD_NEIGHBOUR_FOR_SIMPLE_TEMPLATE_ENTRY_PATTERN = Regex("([a-zA-Z0-9_]|[^\\p{ASCII}]).*")
fun canPlaceAfterSimpleNameEntry(element: PsiElement?): Boolean {
val entryText = element?.text ?: return true
@@ -0,0 +1,5 @@
// IS_APPLICABLE: false
fun foo() {
val x = 3
val y = "$<caret>{x}コトリン"
}
@@ -0,0 +1,4 @@
// "Remove 'toString()' call" "true"
val foo = "test"
val bar = "${foo.toString()<caret>}_"
@@ -0,0 +1,4 @@
// "Remove 'toString()' call" "true"
val foo = "test"
val bar = "${foo<caret>}_"
@@ -0,0 +1,4 @@
// "Remove 'toString()' call" "true"
val foo = "test"
val bar = "${foo.toString()<caret>}コトリン"
@@ -0,0 +1,4 @@
// "Remove 'toString()' call" "true"
val foo = "test"
val bar = "${foo<caret>}コトリン"
@@ -12620,6 +12620,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest {
doTest(fileName);
}
@TestMetadata("necessaryBrackets6.kt")
public void testNecessaryBrackets6() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeCurlyBracesFromTemplate/necessaryBrackets6.kt");
doTest(fileName);
}
@TestMetadata("unnecessaryBrackets1.kt")
public void testUnnecessaryBrackets1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/removeCurlyBracesFromTemplate/unnecessaryBrackets1.kt");
@@ -8879,6 +8879,18 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
doTest(fileName);
}
@TestMetadata("necessaryBrackets1.kt")
public void testNecessaryBrackets1() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/removeToStringInStringTemplate/necessaryBrackets1.kt");
doTest(fileName);
}
@TestMetadata("necessaryBrackets2.kt")
public void testNecessaryBrackets2() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/removeToStringInStringTemplate/necessaryBrackets2.kt");
doTest(fileName);
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/quickfix/removeToStringInStringTemplate/simple.kt");