Check element is valid if canRefactor()
This commit is contained in:
@@ -417,6 +417,8 @@ fun <T> chooseContainerElementIfNecessary(
|
|||||||
fun PsiElement.isTrueJavaMethod(): Boolean = this is PsiMethod && this !is KtLightMethod
|
fun PsiElement.isTrueJavaMethod(): Boolean = this is PsiMethod && this !is KtLightMethod
|
||||||
|
|
||||||
fun PsiElement.canRefactor(): Boolean {
|
fun PsiElement.canRefactor(): Boolean {
|
||||||
|
if (!this.isValid) return false
|
||||||
|
|
||||||
return when {
|
return when {
|
||||||
this is PsiPackage ->
|
this is PsiPackage ->
|
||||||
directories.any { it.canRefactor() }
|
directories.any { it.canRefactor() }
|
||||||
|
|||||||
Reference in New Issue
Block a user