fix(TreeCache): exception when build index

This commit is contained in:
林万程
2024-01-16 22:00:06 +08:00
parent 3c22211895
commit a01f3fa5b3

View File

@@ -1,7 +1,6 @@
package io.github.linwancen.plugin.show.cache; package io.github.linwancen.plugin.show.cache;
import com.intellij.ide.projectView.ProjectViewNode; import com.intellij.ide.projectView.ProjectViewNode;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project; import com.intellij.openapi.project.Project;
@@ -70,7 +69,7 @@ public class TreeCacheUtils {
nodeCache.forEach((node, treeCache) -> { nodeCache.forEach((node, treeCache) -> {
if (treeCache.needUpdate) { if (treeCache.needUpdate) {
treeCache.needUpdate = false; treeCache.needUpdate = false;
ApplicationManager.getApplication().runReadAction(() -> { DumbService.getInstance(project).runReadActionInSmartMode(() -> {
try { try {
treeCache.doc = Tree.treeDoc(node, project); treeCache.doc = Tree.treeDoc(node, project);
} catch (Exception e) { } catch (Exception e) {