CommentTracker#deleteAndRestoreComments: stop at file level

This commit is contained in:
Tagir Valeev
2018-03-02 17:17:29 +07:00
parent 3cf3526ff0
commit ae3f1ec155
@@ -111,7 +111,7 @@ public class CommentTracker {
public void deleteAndRestoreComments(@NotNull PsiElement element) {
grabCommentsOnDelete(element);
PsiElement anchor = element;
while (anchor.getParent() != null && anchor.getParent().getFirstChild() == anchor) {
while (anchor.getParent() != null && !(anchor.getParent() instanceof PsiFile) && anchor.getParent().getFirstChild() == anchor) {
anchor = anchor.getParent();
}
insertCommentsBefore(anchor);