Document org.jetbrains.kotlin.idea.intentions.SelfTargetingIntention#allowCaretInsideElement
Also update its usage so that the contract of this method is easier to understand.
This commit is contained in:
committed by
TeamCityServer
parent
5a1223e812
commit
abcc716ffc
+2
-1
@@ -79,7 +79,7 @@ abstract class SelfTargetingIntention<TElement : PsiElement>(
|
||||
if (elementType.isInstance(element) && isApplicableTo(element as TElement, offset)) {
|
||||
return element
|
||||
}
|
||||
if (!allowCaretInsideElement(element) && element.textRange.containsInside(offset)) break
|
||||
if (element.textRange.containsInside(offset) && !allowCaretInsideElement(element)) break
|
||||
}
|
||||
return null
|
||||
}
|
||||
@@ -89,6 +89,7 @@ abstract class SelfTargetingIntention<TElement : PsiElement>(
|
||||
return getTarget(offset, file)
|
||||
}
|
||||
|
||||
/** Whether to keep looking for targets after having processed the given element, which contains the cursor. */
|
||||
protected open fun allowCaretInsideElement(element: PsiElement): Boolean = element !is KtBlockExpression
|
||||
|
||||
final override fun isAvailable(project: Project, editor: Editor, file: PsiFile): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user