mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Performance fix: don't reformat code style sample twice upon first preview load (see IDEA-127086 Code Style preview: too much delay)
This commit is contained in:
@@ -202,7 +202,9 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
|
||||
ApplicationManager.getApplication().runWriteAction(() -> {
|
||||
try {
|
||||
Document beforeReformat = null;
|
||||
beforeReformat = collectChangesBeforeCurrentSettingsAppliance(project);
|
||||
if (myEditor.getDocument().getTextLength() > 0) {
|
||||
beforeReformat = collectChangesBeforeCurrentSettingsAppliance(project);
|
||||
}
|
||||
|
||||
//important not mark as generated not to get the classes before setting language level
|
||||
PsiFile psiFile = createFileFromText(project, myTextToReformat);
|
||||
@@ -227,7 +229,7 @@ public abstract class CodeStyleAbstractPanel implements Disposable {
|
||||
myEditor.getSettings().setTabSize(clone.getTabSize(getFileType()));
|
||||
Document document = myEditor.getDocument();
|
||||
document.replaceString(0, document.getTextLength(), formatted.getText());
|
||||
if (document != null && beforeReformat != null) {
|
||||
if (beforeReformat != null) {
|
||||
highlightChanges(beforeReformat);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user