EmmyLua / IntelliJ-EmmyLua

Lua IDE/Debugger Plugin for IntelliJ IDEA
https://emmylua.github.io
Apache License 2.0
1.72k stars 287 forks source link

全局函数解析异常 #501

Closed simbeloo closed 1 year ago

simbeloo commented 1 year ago

Environment(环境)

name version
IDEA version Idea2018.3.3
EmmyLua version v1.3.2.142-IDEA182
OS Windows 10

What are the steps to reproduce this issue?(重现步骤?)

1、打开lua文件的工程; 2.、Ctrl+鼠标左键,点击一个全局函数 3.、报错:java.lang.AssertionError: Stub count doesn't match stubbed node length

What happens?(出现什么问题?)

报错,stub和ast的node节点数量对不上,比对下来发现可能是对global function的解析存在问题。 最新的1.3.7版本也存在类似问题。

What were you expecting to happen?(期望?)

Any logs, error output, etc?(有没有什么log, error输出?)

java.lang.AssertionError: Stub count doesn't match stubbed node length at com.intellij.psi.impl.source.FileTrees.lambda$reconcilePsi$3(FileTrees.java:175) at com.intellij.psi.impl.DebugUtil.performPsiModification(DebugUtil.java:562) at com.intellij.psi.impl.source.FileTrees.reconcilePsi(FileTrees.java:168) at com.intellij.psi.impl.source.FileTrees.withAst(FileTrees.java:135) at com.intellij.psi.impl.source.PsiFileImpl.loadTreeElement(PsiFileImpl.java:209) at com.intellij.psi.impl.source.PsiFileImpl.calcTreeElement(PsiFileImpl.java:709) at com.intellij.extapi.psi.StubBasedPsiElementBase.getNode(StubBasedPsiElementBase.java:141) at com.intellij.extapi.psi.ASTDelegatePsiElement.findChildByType(ASTDelegatePsiElement.java:185) at com.tang.intellij.lua.psi.impl.LuaClassMethodNameImpl.getId(LuaClassMethodNameImpl.java:49) at com.tang.intellij.lua.psi.LuaPsiImplUtilKt.getNameIdentifier(LuaPsiImplUtil.kt:82) at com.tang.intellij.lua.psi.impl.LuaClassMethodDefImpl.getNameIdentifier(LuaClassMethodDefImpl.java:82) at com.tang.intellij.lua.psi.LuaPsiImplUtilKt.getTextOffset(LuaPsiImplUtil.kt:443) at com.tang.intellij.lua.psi.impl.LuaClassMethodDefImpl.getTextOffset(LuaClassMethodDefImpl.java:96) at com.intellij.ide.util.EditSourceUtil.getDescriptor(EditSourceUtil.java:55) at com.intellij.ide.util.PsiNavigationSupportImpl.getDescriptor(PsiNavigationSupportImpl.java:25) at com.intellij.psi.impl.PsiElementBase.navigate(PsiElementBase.java:195) at com.intellij.codeInsight.navigation.actions.GotoDeclarationAction.gotoTargetElement(GotoDeclarationAction.java:191) at com.intellij.codeInsight.navigation.actions.GotoDeclarationAction.invoke(GotoDeclarationAction.java:110) at com.intellij.codeInsight.actions.CodeInsightAction.lambda$null$0(CodeInsightAction.java:59) at com.intellij.codeInsight.actions.CodeInsightAction.lambda$actionPerformedImpl$1(CodeInsightAction.java:65) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:178) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:168) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:154) at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformedImpl(CodeInsightAction.java:56) at com.intellij.codeInsight.actions.CodeInsightAction.actionPerformed(CodeInsightAction.java:29) at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:258) at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88) at com.intellij.openapi.application.TransactionGuardImpl.submitTransactionAndWait(TransactionGuardImpl.java:153) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:273) at com.intellij.openapi.keymap.impl.IdeMouseEventDispatcher.dispatchMouseEvent(IdeMouseEventDispatcher.java:261) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:663) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Any other comments?(其它说明)

leaveye commented 1 year ago

这个问题出现有些时候了。有啥进展么?

CppCXY commented 1 year ago

虽然我知道改哪里,但是因为一些原因这个改动没有上

tangzx commented 1 year ago

最新版本1.4.+应该OK了,这一系列的问题原因是index机制问题,之前一直没有解决方案所以解决不了。现在这块终于重新设计了。