void (final PsiElement element) { final TextRange textRange = element.getTextRange(); PsiFile file = element.getContainingFile(); FileViewProvider viewProvider = file.getViewProvider(); if (viewProvider instanceof MultiplePsiFilesPerDocumentFileViewProvider multiProvider) { file = multiProvider.getPsi(multiProvider.getBaseLanguage()); LOG.assertTrue(file != null, element + " " + multiProvider.getBaseLanguage()); } try { CodeStyleManager.getInstance(element.getProject()) .reformatText(file, textRange.getStartOffset(), textRange.getEndOffset()); } catch (IncorrectOperationException e) { LOG.error(e); } }