Rename: Add quotes to declaration name if necessary

#KT-22708 Fixed
This commit is contained in:
Alexey Sedunov
2018-02-06 19:22:46 +03:00
parent 428b086458
commit e88f1467eb
4 changed files with 16 additions and 1 deletions
@@ -104,7 +104,8 @@ abstract class KtNamedDeclarationStub<T extends KotlinStubWithFqName<?>> extends
}
}
PsiElement newIdentifier = KtPsiFactory(this).createNameIdentifierIfPossible(name);
PsiElement newIdentifier =
KtPsiFactory(this).createNameIdentifierIfPossible(KtPsiUtilKt.quoteIfNeeded(name));
if (newIdentifier != null) {
KtPsiUtilKt.astReplace(identifier, newIdentifier);
}
+5
View File
@@ -0,0 +1,5 @@
fun <caret>foo() {}
fun main(args: Array<String>) {
foo()
}
@@ -0,0 +1,5 @@
fun `is`() {}
fun main(args: Array<String>) {
`is`()
}
@@ -110,6 +110,10 @@ class InplaceRenameTest : LightPlatformCodeInsightTestCase() {
doTestMemberInplaceRename("plus")
}
fun testAddQuotes() {
doTestMemberInplaceRename("is")
}
private fun doTestImplicitLambdaParameter(newName: String) {
configureByFile(getTestName(false) + ".kt")