Delete/Move: Delete entire file when deleting top-level class or object and no other top-level declarations are present. Ask the user confirmation if deletion if caused by the Move refactoring
#KT-8033 Fixed
This commit is contained in:
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.idea.core
|
||||
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil
|
||||
@@ -148,4 +149,8 @@ private fun deleteElementWithDelimiters(element: PsiElement) {
|
||||
val parent = element.getParent()
|
||||
|
||||
parent.deleteChildRange(from, to)
|
||||
}
|
||||
|
||||
public fun PsiElement.deleteSingle() {
|
||||
CodeEditUtil.removeChild(getParent()?.getNode() ?: return, getNode() ?: return)
|
||||
}
|
||||
Reference in New Issue
Block a user