Rename: Quote non-identifier names in Kotlin references

#KT-9156 Fixed
This commit is contained in:
Alexey Sedunov
2016-05-24 15:30:02 +03:00
parent a743098aba
commit 691de677b3
8 changed files with 34 additions and 1 deletions
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.idea.codeInsight.shorten.addToShorteningWaitSet
import org.jetbrains.kotlin.idea.intentions.OperatorToFunctionIntention
import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
import org.jetbrains.kotlin.idea.core.ShortenReferences
import org.jetbrains.kotlin.idea.core.quoteIfNeeded
import org.jetbrains.kotlin.lexer.KtToken
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.load.java.descriptors.JavaPropertyDescriptor
@@ -114,7 +115,7 @@ class KtSimpleNameReference(expression: KtSimpleNameExpression) : KtSimpleRefere
val element = Extensions.getArea(expression.project).getExtensionPoint(SimpleNameReferenceExtension.EP_NAME).extensions
.asSequence()
.map { it.handleElementRename(this, psiFactory, newElementName) }
.firstOrNull { it != null } ?: psiFactory.createNameIdentifier(newElementName)
.firstOrNull { it != null } ?: psiFactory.createNameIdentifier(newElementName.quoteIfNeeded())
val nameElement = expression.getReferencedNameElement()