correctly implement JetSimpleNameReference.getTextRange() so that it doesn't include the @ character for references in labels
#KT-7560 Fixed
This commit is contained in:
committed by
Alexey Sedunov
parent
ca8fb53ccd
commit
093878bd06
+5
-1
@@ -61,7 +61,11 @@ public class JetSimpleNameReference(
|
||||
return super.isReferenceTo(element)
|
||||
}
|
||||
|
||||
override fun getRangeInElement(): TextRange = TextRange(0, getElement().getTextLength())
|
||||
override fun getRangeInElement(): TextRange {
|
||||
val element = getElement().getReferencedNameElement()
|
||||
val startOffset = getElement().getTextRange().getStartOffset()
|
||||
return element.getTextRange().shiftRight(-startOffset)
|
||||
}
|
||||
|
||||
override fun canRename(): Boolean {
|
||||
if (expression.getParentOfTypeAndBranch<JetWhenConditionInRange>(strict = true){ getOperationReference() } != null) return false
|
||||
|
||||
Reference in New Issue
Block a user