tuchg / ChinesePinyin-CodeCompletionHelper

让你的 JetBrains 系 IDE ( IDEA ,PyCharm,PhpStorm,WebStorm,AndroidStudio,GoLand等 )支持中文标识符以拼音/五笔等输入方式完成代码补全,享受和英文环境一致的中文智能编码体验,为代码表达提供更多选择,一种值得考虑的折中解决方案📏
https://plugins.jetbrains.com/plugin/14838
MIT License
1.59k stars 44 forks source link

【Bug】是我看不懂的问题:com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: PSI and index do not match. #58

Closed fr1g closed 2 years ago

fr1g commented 2 years ago

请事先检查下列事项

编程语言

Java

预期表现

至少IDE不会报错

当前表现

它报错了!

可能的解决方案

不知道

重现错误场景

静置,极低概率复现。

提供代码片段或截图

使用环境

报错窗口标题:IDE致命错误 内容: com.intellij.openapi.diagnostic.RuntimeExceptionWithAttachments: PSI and index do not match. Please report the problem to JetBrains with the files attached file=PsiFile:COFFFileParser.class, file.class=class com.intellij.psi.impl.compiled.ClsFileImpl, file.lang=Language: JAVA, modStamp=0 stub debugInfo=created from file content; with backReference latestIndexedStub=null viewProvider=com.intellij.psi.ClassFileViewProvider{vFile=jrt://用户目录/.jdks/azul-16.0.2!/jdk.hotspot.agent/sun/jvm/hotspot/debugger/win32/coff/COFFFileParser.class, vFileId=93827, content=VirtualFileContent{size=15199}, eventSystemEnabled=true} viewProvider stamp: 0; file stamp: 0; file modCount: 1649061466229; file length: 15199 indexing info: null at com.intellij.psi.stubs.StubTreeLoader.lambda$stubTreeAndIndexDoNotMatch$0(StubTreeLoader.java:131) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646) at com.intellij.openapi.progress.impl.CoreProgressManager.computeInNonCancelableSection(CoreProgressManager.java:237) at com.intellij.psi.stubs.StubTreeLoader.stubTreeAndIndexDoNotMatch(StubTreeLoader.java:65) at com.intellij.psi.stubs.StubProcessingHelperBase.inconsistencyDetected(StubProcessingHelperBase.java:151) at com.intellij.psi.stubs.StubProcessingHelperBase.checkType(StubProcessingHelperBase.java:93) at com.intellij.psi.stubs.StubProcessingHelperBase.processStubsInFile(StubProcessingHelperBase.java:72) at com.intellij.psi.stubs.StubIndexImpl.lambda$processElements$2(StubIndexImpl.java:300) at com.intellij.psi.stubs.StubIndexImpl.processElements(StubIndexImpl.java:346) at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:100) at com.intellij.psi.stubs.StubIndex.getElements(StubIndex.java:88) at com.intellij.psi.impl.java.stubs.index.JavaShortClassNameIndex.get(JavaShortClassNameIndex.java:35) at com.intellij.psi.impl.PsiShortNamesCacheImpl.getClassesByName(PsiShortNamesCacheImpl.java:49) at com.intellij.psi.impl.CompositeShortNamesCache.getClassesByName(CompositeShortNamesCache.java:68) at com.intellij.psi.impl.search.AllClassesSearchExecutor.lambda$processByName$2(AllClassesSearchExecutor.java:86) at com.intellij.openapi.project.DumbService.lambda$runReadActionInSmartMode$0(DumbService.java:113) at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:144) at com.intellij.openapi.project.DumbService.runReadActionInSmartMode(DumbService.java:113) at com.intellij.psi.impl.search.AllClassesSearchExecutor.processByName(AllClassesSearchExecutor.java:86) at com.intellij.psi.impl.search.AllClassesSearchExecutor.processClassesByNames(AllClassesSearchExecutor.java:76) at com.intellij.codeInsight.completion.AllClassesGetter.processJavaClasses(AllClassesGetter.java:137) at com.intellij.codeInsight.completion.JavaClassNameCompletionContributor.addAllClasses(JavaClassNameCompletionContributor.java:191) at com.intellij.codeInsight.completion.JavaNoVariantsDelegator.suggestNonImportedClasses(JavaNoVariantsDelegator.java:208) at com.intellij.codeInsight.completion.JavaNoVariantsDelegator.fillCompletionVariants(JavaNoVariantsDelegator.java:78) at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:77) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:154) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:146) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142) at com.github.tuchg.nonasciicodecompletionhelper.completion.contributors.ChineseCompletionContributor.fillCompletionVariants(ChineseCompletionContributor.kt:41) at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:77) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:154) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:146) at com.intellij.codeInsight.completion.CompletionResultSet.runRemainingContributors(CompletionResultSet.java:142) at com.intellij.codeInsight.template.impl.LiveTemplateCompletionContributor$1.addCompletions(LiveTemplateCompletionContributor.java:89) at com.intellij.codeInsight.completion.CompletionProvider.addCompletionVariants(CompletionProvider.java:25) at com.intellij.codeInsight.completion.CompletionContributor.fillCompletionVariants(CompletionContributor.java:158) at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:77) at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:60) at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:133) at com.intellij.codeInsight.completion.BaseCompletionService.performCompletion(BaseCompletionService.java:41) at com.intellij.codeInsight.completion.CompletionProgressIndicator.lambda$calculateItems$12(CompletionProgressIndicator.java:865) at com.intellij.util.indexing.FileBasedIndex.lambda$ignoreDumbMode$0(FileBasedIndex.java:172) at com.intellij.openapi.util.RecursionManager$1.computePreventingRecursion(RecursionManager.java:114) at com.intellij.util.indexing.FileBasedIndexEx.ignoreDumbMode(FileBasedIndexEx.java:581) at com.intellij.util.indexing.FileBasedIndex.ignoreDumbMode(FileBasedIndex.java:171) at com.intellij.util.indexing.DumbModeAccessType.ignoreDumbMode(DumbModeAccessType.java:43) at com.intellij.codeInsight.completion.CompletionProgressIndicator.calculateItems(CompletionProgressIndicator.java:861) at com.intellij.codeInsight.completion.CompletionProgressIndicator.runContributors(CompletionProgressIndicator.java:849) at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$6(CodeCompletionHandlerBase.java:352) at com.intellij.codeInsight.completion.AsyncCompletion.lambda$tryReadOrCancel$5(CompletionThreading.java:172) at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1084) at com.intellij.codeInsight.completion.AsyncCompletion.tryReadOrCancel(CompletionThreading.java:170) at com.intellij.codeInsight.completion.CodeCompletionHandlerBase.lambda$startContributorThread$7(CodeCompletionHandlerBase.java:344) at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$0(CompletionThreading.java:95) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188) at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698) at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66) at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175) at com.intellij.codeInsight.completion.AsyncCompletion.lambda$startThread$1(CompletionThreading.java:91) at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:263) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665) at java.base/java.lang.Thread.run(Thread.java:829)

tuchg commented 2 years ago

收到!经过初步分析调用栈与插件相关可定位 resultSet.runRemainingContributors(parameters) { r 该行代码只会执行IDE匹配链路和插件本身无关,应该可以成功和插件撇清关系,且插件不会对PSI树进行直接操作,只会通过一些规则修改补全列表,不会影响到索引的维护