remove the hack to disable indent detection during async editor loading (WEB-21649)

This commit is contained in:
peter
2016-05-30 19:33:41 +02:00
parent e98ce78e91
commit d4e782efec
3 changed files with 5 additions and 26 deletions

View File

@@ -32,7 +32,6 @@ import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces;
import com.intellij.openapi.fileEditor.impl.text.AsyncEditorLoader;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
@@ -337,7 +336,7 @@ public class SettingsImpl implements EditorSettings {
}
private void reinitDocumentIndentOptions() {
if (myEditor == null || myEditor.isViewer() || AsyncEditorLoader.isCreatingAsyncEditor()) return;
if (myEditor == null || myEditor.isViewer()) return;
final Project project = myEditor.getProject();
final DocumentEx document = myEditor.getDocument();
@@ -364,7 +363,7 @@ public class SettingsImpl implements EditorSettings {
if (myTabSize != null) return myTabSize.intValue();
if (myCachedTabSize != null) return myCachedTabSize.intValue();
int tabSize;
if (project == null || project.isDisposed() || AsyncEditorLoader.isCreatingAsyncEditor()) {
if (project == null || project.isDisposed()) {
tabSize = CodeStyleSettingsManager.getSettings(null).getTabSize(null);
}
else {

View File

@@ -17,14 +17,14 @@ package com.intellij.openapi.fileEditor.impl.text;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.FileEditorStateLevel;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
import com.intellij.openapi.progress.util.ProgressIndicatorUtils;
import com.intellij.openapi.progress.util.ReadTask;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Ref;
@@ -199,24 +199,4 @@ public class AsyncEditorLoader {
public static boolean isEditorLoaded(@NotNull Editor editor) {
return editor.getUserData(ASYNC_LOADER) == null;
}
//todo remove this with async indent inference
public static boolean isCreatingAsyncEditor() {
ApplicationManager.getApplication().assertIsDispatchThread();
return ourCreatingAsyncEditor;
}
@NotNull
static TextEditorComponent createAsyncEditor(@NotNull Computable<TextEditorComponent> computable) {
ApplicationManager.getApplication().assertIsDispatchThread();
assert !ourCreatingAsyncEditor;
ourCreatingAsyncEditor = true;
try {
return computable.compute();
}
finally {
ourCreatingAsyncEditor = false;
}
}
}

View File

@@ -49,7 +49,7 @@ public class TextEditorImpl extends UserDataHolderBase implements TextEditor {
myProject = project;
myFile = file;
myChangeSupport = new PropertyChangeSupport(this);
myComponent = AsyncEditorLoader.createAsyncEditor(() -> createEditorComponent(project, file));
myComponent = createEditorComponent(project, file);
myAsyncLoader = new AsyncEditorLoader(this, myComponent, provider);
myAsyncLoader.scheduleBackgroundLoading(true);
}