Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

会破坏goland的项目索引 #48

Open
ZHOUXING1997 opened this issue Oct 11, 2023 · 4 comments
Open

会破坏goland的项目索引 #48

ZHOUXING1997 opened this issue Oct 11, 2023 · 4 comments
Labels
compatibility Not compatible with new version IDE

Comments

@ZHOUXING1997
Copy link

在goland中使用这个插件会导致项目所以失效,需要清除缓存重新建立索引才能修复

Goland: 2023.2.2
插件:2.10.0.2023.09.06_08.08

日志没了~~

@LinWanCen LinWanCen added the compatibility Not compatible with new version IDE label Oct 11, 2023
@ZHOUXING1997
Copy link
Author

在 goland eap 版本中拿到报错
GoLand 2023.3 Beta

java.lang.Throwable: Slow operations are prohibited on EDT. See SlowOperations.assertSlowOperationsAreAllowed javadoc.
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:376)
at com.intellij.util.SlowOperations.assertSlowOperationsAreAllowed(SlowOperations.java:101)
at com.intellij.util.indexing.FileBasedIndexScanUtil.ensureUpToDate(FileBasedIndexScanUtil.java:47)
at com.intellij.util.indexing.FileBasedIndexScanUtil.processAllKeys(FileBasedIndexScanUtil.java:77)
at com.intellij.util.indexing.FileBasedIndexImpl.processAllKeys(FileBasedIndexImpl.java:814)
at com.intellij.psi.search.FilenameIndex.processAllFileNameCharSequences(FilenameIndex.java:51)
at com.intellij.psi.search.FilenameIndex.processAllFileNames(FilenameIndex.java:45)
at com.intellij.psi.search.FilenameIndex.getAllFilenames(FilenameIndex.java:37)
at com.intellij.psi.search.FilenameIndex.getAllFilesByExt(FilenameIndex.java:201)
at com.intellij.psi.search.FilenameIndex.getAllFilesByExt(FilenameIndex.java:190)
at io.github.linwancen.plugin.show.ext.conf.ConfCache.lambda$loadAll$0(ConfCache.java:122)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:878)
at io.github.linwancen.plugin.show.ext.conf.ConfCache.lambda$loadAll$1(ConfCache.java:121)
at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.kt:117)
at io.github.linwancen.plugin.show.ext.conf.ConfCache.loadAll(ConfCache.java:120)
at io.github.linwancen.plugin.show.ext.conf.ConfFileInitListener.projectOpened(ConfFileInitListener.java:19)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:700)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:664)
at com.intellij.util.messages.impl.MessageBusImplKt.executeOrAddToQueue(MessageBusImpl.kt:492)
at com.intellij.util.messages.impl.ToDirectChildrenMessagePublisher.publish$intellij_platform_core(CompositeMessageBus.kt:310)
at com.intellij.util.messages.impl.MessagePublisher.invoke(MessageBusImpl.kt:449)
at jdk.proxy1/jdk.proxy1.$Proxy98.projectOpened(Unknown Source)
at com.intellij.openapi.project.impl.ProjectManagerImplKt$runInitProjectActivities$2.invokeSuspend(ProjectManagerImpl.kt:989)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at com.intellij.openapi.application.impl.DispatchedRunnable.run(DispatchedRunnable.kt:43)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:843)
at com.intellij.openapi.application.impl.ApplicationImpl$4.run(ApplicationImpl.java:463)
at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:75)
at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:67)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1430)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:124)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:44)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:695)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:589)
at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:44)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:589)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:72)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:355)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:354)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:793)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:354)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:349)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1014)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1014)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:349)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:848)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:391)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

@LinWanCen
Copy link
Owner

报错是说在 UI 线程执行了个慢操作,之前写异步的时候没看源码用了两个不是异步的方法包裹,尝试修改如下,你更新到 2.12 版本看看。

DumbService.getInstance(project).runReadActionInSmartMode(() ->
    ApplicationManager.getApplication().runReadAction(() -> {
改成
DumbService.getInstance(project).smartInvokeLater(() -> {

static void loadAll(@NotNull Project project) {
DumbService.getInstance(project).smartInvokeLater(() -> {
@NotNull Collection<VirtualFile> files = FilenameIndex.getAllFilesByExt(project, TsvLoader.EXT);
@NotNull StringBuilder sb = new StringBuilder();
for (@NotNull VirtualFile file : files) {
load(file);
sb.append(file.getName()).append("\n");
}
if (files.isEmpty()) {
return;
}
ProjectView.getInstance(project).refresh();
LOG.info("Ext doc conf load all complete {} files\n{}", files.size(), sb);
});
}

@ZHOUXING1997
Copy link
Author

ZHOUXING1997 commented Nov 30, 2023 via email

@LinWanCen
Copy link
Owner

您好,这个问题现在还出现吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Not compatible with new version IDE
Projects
None yet
Development

No branches or pull requests

2 participants