Rename: Add quotes to declaration name if necessary
#KT-22708 Fixed
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user