Open ViugiNick opened 3 months ago
可以通过去掉在childrenChanged中执行的BracketFinder.findBrackets来解决问题,UI阻塞是BracketFinder.findBrackets本身需要做大量的事,而childrenChanged在API中描述的意思是每个child变化都会执行这个函数,我想知道你出问题时的代码量有多大
java.desktop@17.0.10/java.awt.EventQueue.dispatchEvent(Unknown Source) [55600ms] java.base@17.0.10/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) [55600ms] java.base@17.0.10/java.security.AccessController.doPrivileged(Unknown Source) [55600ms] java.base@17.0.10/java.security.AccessController.executePrivileged(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventQueue$3.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventQueue$3.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventQueue.dispatchEventImpl(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.event.InvocationEvent.dispatch(Unknown Source) [55600ms] com.intellij.openapi.application.impl.FlushQueue$$Lambda$564/0x0000000800614000.run(Unknown Source) [55600ms] com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43) [55600ms] com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:123) [55600ms] com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:81) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1152) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:129) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:138) [55600ms] com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:101) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:419) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:204) [55600ms] com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191) [55600ms] com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22) [55600ms] com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209) [55600ms] com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27) [55600ms] git4idea.merge.GitConflictResolver$$Lambda$6764/0x0000000802cd6e30.run(Unknown Source) [55600ms] git4idea.merge.GitConflictResolver.lambda$showMergeDialog$0(GitConflictResolver.java:198) [55600ms] com.intellij.openapi.vcs.impl.AbstractVcsHelperImpl.showMergeDialog(AbstractVcsHelperImpl.java:409) [55600ms] com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:1703) [55600ms] com.intellij.openapi.ui.DialogWrapper.doShow(DialogWrapper.java:1754) [55600ms] com.intellij.openapi.ui.impl.DialogWrapperPeerImpl.show(DialogWrapperPeerImpl.java:474) [55600ms] com.intellij.openapi.ui.impl.DialogWrapperPeerImpl$MyDialog.show(DialogWrapperPeerImpl.java:898) [55600ms] java.desktop@17.0.10/java.awt.Dialog.show(Unknown Source) [55600ms] java.desktop@17.0.10/sun.awt.SunToolkit.performOnMainThreadIfNeeded(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.Dialog$$Lambda$206/0x000000080034db88.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.Dialog.lambda$show$2(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.WaitDispatchSupport.enter(Unknown Source) [55600ms] java.base@17.0.10/java.security.AccessController.doPrivileged(Unknown Source) [55600ms] java.base@17.0.10/java.security.AccessController.executePrivileged(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.WaitDispatchSupport$4.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.WaitDispatchSupport$4.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.WaitDispatchSupport$2.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [55600ms] com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:398) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:204) [55600ms] com.intellij.ide.IdeEventQueue$$Lambda$719/0x00000008007b46e8.run(Unknown Source) [55600ms] com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:356) [55600ms] com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1022) [55600ms] com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:114) [55600ms] com.intellij.ide.IdeEventQueueKt$$Lambda$723/0x00000008007b7968.run(Unknown Source) [55600ms] com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1022) [55600ms] com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:356) [55600ms] com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:361) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:843) [55600ms] com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:361) [55600ms] com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:362) [55600ms] com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:77) [55600ms] com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:593) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:105) [55600ms] com.intellij.ide.IdeEventQueue$$Lambda$725/0x00000008007ba470.run(Unknown Source) [55600ms] com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:593) [55600ms] com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:699) [55600ms] java.desktop@17.0.10/java.awt.EventQueue.dispatchEvent(Unknown Source) [55600ms] java.base@17.0.10/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) [55600ms] java.base@17.0.10/java.security.AccessController.doPrivileged(Unknown Source) [55600ms] java.base@17.0.10/java.security.AccessController.executePrivileged(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventQueue$3.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventQueue$3.run(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.EventQueue.dispatchEventImpl(Unknown Source) [55600ms] java.desktop@17.0.10/java.awt.event.InvocationEvent.dispatch(Unknown Source) [55600ms] com.intellij.openapi.application.impl.FlushQueue$$Lambda$564/0x0000000800614000.run(Unknown Source) [55600ms] com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43) [55600ms] com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:123) [55600ms] com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:81) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1152) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:129) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:138) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:419) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:204) [55600ms] com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191) [55600ms] com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22) [55600ms] com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209) [55600ms] com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission$$Lambda$2105/0x00000008015502c0.run(Unknown Source) [55600ms] com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$safeTransferToEdt$7(NonBlockingReadActionImpl.java:728) [55600ms] com.intellij.psi.impl.DocumentCommitThread$$Lambda$5789/0x00000008028b7c98.accept(Unknown Source) [55600ms] com.intellij.psi.impl.DocumentCommitThread$$Lambda$5860/0x00000008028ea710.run(Unknown Source) [55600ms] com.intellij.psi.impl.DocumentCommitThread.lambda$commitUnderProgress$2(DocumentCommitThread.java:140) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase.finishCommit(PsiDocumentManagerBase.java:366) [55600ms] com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:883) [55600ms] com.intellij.openapi.application.impl.RwLockHolder.runWriteAction(RwLockHolder.kt:344) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase$2.run(PsiDocumentManagerBase.java:369) [55600ms] com.intellij.psi.impl.PsiDocumentManagerImpl.finishCommitInWriteAction(PsiDocumentManagerImpl.java:134) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase.finishCommitInWriteAction(PsiDocumentManagerBase.java:402) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase.executeInsideCommit(PsiDocumentManagerBase.java:520) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase$$Lambda$5867/0x00000008028f5c80.run(Unknown Source) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase.lambda$finishCommitInWriteAction$6(PsiDocumentManagerBase.java:404) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:277) [55600ms] com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:57) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager$$Lambda$1776/0x000000080135c6b8.compute(Unknown Source) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:277) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase$$Lambda$5868/0x00000008028f5ed0.compute(Unknown Source) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase.lambda$finishCommitInWriteAction$5(PsiDocumentManagerBase.java:409) [55600ms] com.intellij.psi.impl.PsiDocumentManagerBase.commitToExistingPsi(PsiDocumentManagerBase.java:435) [55600ms] com.intellij.psi.impl.DocumentCommitThread$$Lambda$5857/0x00000008028ea260.run(Unknown Source) [55600ms] com.intellij.psi.impl.DocumentCommitThread.lambda$doCommit$5(DocumentCommitThread.java:302) [55600ms] com.intellij.psi.impl.DiffLog.doActualPsiChange(DiffLog.java:230) [55600ms] com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:442) [55600ms] com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.performActionWithFormatterDisabled(CodeStyleManagerImpl.java:471) [55600ms] com.intellij.psi.impl.source.PostprocessReformattingAspectImpl.disablePostprocessFormattingInside(PostprocessReformattingAspectImpl.java:128) [55600ms] com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$$Lambda$5871/0x00000008028f7318.compute(Unknown Source) [55600ms] com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.lambda$performActionWithFormatterDisabled$8(CodeStyleManagerImpl.java:443) [55600ms] com.intellij.psi.impl.DiffLog$$Lambda$5870/0x00000008028f70c8.run(Unknown Source) [55600ms] com.intellij.psi.impl.DiffLog.lambda$doActualPsiChange$0(DiffLog.java:242) [55600ms] com.intellij.pom.core.impl.PomModelImpl.runTransaction(PomModelImpl.java:92) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:268) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:277) [55600ms] com.intellij.openapi.progress.Cancellation.computeInNonCancelableSection(Cancellation.java:53) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager$$Lambda$1776/0x000000080135c6b8.compute(Unknown Source) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.lambda$computeInNonCancelableSection$4(CoreProgressManager.java:277) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:684) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager$$Lambda$2078/0x00000008014fabe8.compute(Unknown Source) [55600ms] com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeNonCancelableSection$3(CoreProgressManager.java:269) [55600ms] com.intellij.pom.core.impl.PomModelImpl$$Lambda$5872/0x00000008028f3000.run(Unknown Source) [55600ms] com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$2(PomModelImpl.java:103) [55600ms] com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:535) [55600ms] com.intellij.pom.core.impl.PomModelImpl$$Lambda$5874/0x00000008028f3938.run(Unknown Source) [55600ms] com.intellij.pom.core.impl.PomModelImpl.lambda$runTransaction$1(PomModelImpl.java:129) [55600ms] com.intellij.psi.impl.source.PostprocessReformattingAspectImpl$LangPomModel.updateDependentAspects(PostprocessReformattingAspectImpl.java:87) [55600ms] com.intellij.pom.core.impl.PomModelImpl.updateDependentAspects(PomModelImpl.java:167) [55600ms] com.intellij.pom.wrappers.PsiEventWrapperAspect.update(PsiEventWrapperAspect.java:32) [55600ms] com.intellij.pom.tree.events.impl.TreeChangeEventImpl.fireEvents(TreeChangeEventImpl.java:130) [55600ms] com.intellij.pom.tree.events.impl.TreeChangeImpl.fireEvents(TreeChangeImpl.java:143) [55600ms] com.intellij.pom.tree.events.impl.ChangeInfoImpl.fireEvent(ChangeInfoImpl.java:72) [55600ms] com.intellij.pom.tree.events.impl.ChangeInfoImpl.childrenChanged(ChangeInfoImpl.java:122) [55600ms] com.intellij.psi.impl.PsiManagerImpl.childrenChanged(PsiManagerImpl.java:306) [55600ms] com.intellij.psi.impl.PsiManagerImpl.fireEvent(PsiManagerImpl.java:357) [55600ms] com.intellij.psi.impl.PsiManagerImpl.notifyPsiTreeChangeListener(PsiManagerImpl.java:414) [55600ms] com.automain.colorfulbrackets.listener.PluginPsiTreeChangeListener.childrenChanged(PluginPsiTreeChangeListener.kt:74) [55600ms]
卧槽,我之前理解错了,我优化一下