Check element is valid if canRefactor()

This commit is contained in:
Nikolay Krasko
2016-02-10 15:03:03 +03:00
parent 9b44b0b1c0
commit e1d12af2fd
@@ -417,6 +417,8 @@ fun <T> chooseContainerElementIfNecessary(
fun PsiElement.isTrueJavaMethod(): Boolean = this is PsiMethod && this !is KtLightMethod
fun PsiElement.canRefactor(): Boolean {
if (!this.isValid) return false
return when {
this is PsiPackage ->
directories.any { it.canRefactor() }