void (@NotNull AnActionEvent e) { PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE); Project project = e.getProject(); if (project == null || psiFile == null) return; StringBuilder output = new StringBuilder(); dumpModelForFile(psiFile, output, psiFile.getTextRange()); InjectedLanguageManager injectedLanguageManager = InjectedLanguageManager.getInstance(project); List<PsiFile> injectedFiles = injectedLanguageManager .getCachedInjectedDocumentsInRange(psiFile, psiFile.getTextRange()) .stream() .map(documentWindow -> PsiDocumentManager.getInstance(project).getPsiFile(documentWindow)) .filter(psi -> psi != null) .sorted(Comparator.comparingInt(psi -> injectedLanguageManager.injectedToHost(psi, psi.getTextRange()).getStartOffset())) .toList(); for (PsiFile injectedFile : injectedFiles) { dumpModelForFile(injectedFile, output, injectedLanguageManager.injectedToHost(injectedFile, injectedFile.getTextRange())); } VirtualFile file; try { File tempFile = FileUtil.createTempFile("formattingModel-" + psiFile.getName() + "-", ".txt"); FileUtil.writeToFile(tempFile, output.toString()); file = LocalFileSystem.getInstance().findFileByIoFile(tempFile); if (file == null) { return; } } catch (Exception exception) { LOG.error(exception); return; } OpenFileDescriptor fileDescriptor = new OpenFileDescriptor(project, file); FileEditorManager.getInstance(project).openEditor(fileDescriptor, true); }