PsiElement (@NotNull PsiFile file, final @NotNull PsiElement element, boolean isWhitespaceOnly) { CodeStyleSettings settingsForFile = CodeStyle.getSettings(file); List<TextRange> textRanges; if (settingsForFile.FORMATTER_TAGS_ENABLED) { FormatterTagHandler tagHandler = new FormatterTagHandler(settingsForFile); textRanges = tagHandler.getEnabledRanges(file.getNode(), file.getTextRange()); } else { textRanges = Collections.singletonList(element.getTextRange()); } for (TextRange range : textRanges) { if (range.contains(element.getTextRange())) { PsiElement currElement = element; for (PostFormatProcessor postFormatProcessor : getPostProcessors(isWhitespaceOnly)) { if (currElement == null) break; currElement = processElementOrFail(postFormatProcessor, currElement, settingsForFile); } return currElement; } else if (range.intersects(element.getTextRange())) { postProcessRange(file, element.getTextRange().intersection(range), settingsForFile, isWhitespaceOnly); } } return element; }