void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { YAMLAnchor anchor = (YAMLAnchor)descriptor.getPsiElement(); if (anchor == null) { return; } PostprocessReformattingAspect.getInstance(project).disablePostprocessFormattingInside(() -> { ASTNode node = TreeUtil.prevLeaf(anchor.getNode()); while (YAMLElementTypes.SPACE_ELEMENTS.contains(PsiUtilCore.getElementType(node))) { ASTNode prev = TreeUtil.prevLeaf(node); ASTNode parent = node.getTreeParent(); if (parent != null) { CodeEditUtil.removeChild(parent, node); } node = prev; } anchor.delete(); }); }