pref: Vue src/router tree doc runReadAction slow and lineEnd Cache update sync
This commit is contained in:
@@ -91,18 +91,18 @@ public class LineEndCacheUtils {
|
||||
|
||||
private static void cacheUpdate() {
|
||||
cache.forEach((project, fileMap) -> {
|
||||
try {
|
||||
if (project.isDisposed()) {
|
||||
cache.remove(project);
|
||||
return;
|
||||
}
|
||||
fileMap.forEach((file, lineMap) -> lineMap.forEach((lineNumber, lineCache) -> {
|
||||
@NotNull LineInfo info = lineCache.info;
|
||||
@Nullable List<LineExtensionInfo> list = lineCache.map.get(info.text);
|
||||
if (!(lineCache.needUpdate() || list == null)) {
|
||||
ReadAction.nonBlocking(() -> {
|
||||
try {
|
||||
if (project.isDisposed()) {
|
||||
cache.remove(project);
|
||||
return;
|
||||
}
|
||||
ReadAction.nonBlocking(() -> {
|
||||
fileMap.forEach((file, lineMap) -> lineMap.forEach((lineNumber, lineCache) -> {
|
||||
@NotNull LineInfo info = lineCache.info;
|
||||
@Nullable List<LineExtensionInfo> list = lineCache.map.get(info.text);
|
||||
if (!(lineCache.needUpdate() || list == null)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (project.isDisposed() || DumbService.isDumb(project)) {
|
||||
return;
|
||||
@@ -137,15 +137,16 @@ public class LineEndCacheUtils {
|
||||
LOG.info("LineEndCacheUtils lineMap.forEach catch Throwable but log to record.", e);
|
||||
}
|
||||
}
|
||||
}).inSmartMode(project).executeSynchronously();
|
||||
}));
|
||||
} catch (ProcessCanceledException ignored) {
|
||||
} catch (IllegalStateException ignore) {
|
||||
// ignore inSmartMode(project) throw:
|
||||
// @NotNull method com/intellij/openapi/project/impl/ProjectImpl.getEarlyDisposable must not return null
|
||||
} catch (Throwable e) {
|
||||
LOG.info("LineEndCacheUtils cache.forEach catch Throwable but log to record.", e);
|
||||
}
|
||||
}));
|
||||
} catch (ProcessCanceledException ignored) {
|
||||
} catch (IllegalStateException ignore) {
|
||||
// ignore inSmartMode(project) throw:
|
||||
// @NotNull method com/intellij/openapi/project/impl/ProjectImpl.getEarlyDisposable must not
|
||||
// return null
|
||||
} catch (Throwable e) {
|
||||
LOG.info("LineEndCacheUtils cache.forEach catch Throwable but log to record.", e);
|
||||
}
|
||||
}).inSmartMode(project).submit(AppExecutorUtil.getAppExecutorService());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +46,8 @@ public abstract class FileLoader {
|
||||
|
||||
public void loadAll(@NotNull Project project) {
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() ->
|
||||
DumbService.getInstance(project).runReadActionInSmartMode(() ->
|
||||
ApplicationManager.getApplication().runReadAction(() ->
|
||||
loadAllImpl(project))));
|
||||
DumbService.getInstance(project).runReadActionInSmartMode(()
|
||||
-> loadAllImpl(project)));
|
||||
}
|
||||
|
||||
void loadFile(@NotNull VirtualFile file, @Nullable Project project) {
|
||||
|
||||
Reference in New Issue
Block a user