lte2000 / intellibot

IntelliJ/PyCharm plugin for Robot Automation Framework
https://github.com/lte2000/intellibot
MIT License
90 stars 27 forks source link

Plugin crashes when braces are opened and closed fast (issue present on the old plugin too) #2

Closed zastress closed 4 years ago

zastress commented 4 years ago

When trying to create a variable and we open and close the braces fast, the plugin crashes. (per example, when you try to create a variable, you type ${ and after 1-2 seconds you close the syntax with the }. As a personal observation, this happens mostly inside big files where there are alot of variables and keywords. Error: com.intellij.diagnostic.PluginException: commitDocument() left PSI inconsistent: file/doc text length different, File[FILE iOS-res.robot, Language: Robot, com.intellij.psi.SingleRootFileViewProvider{myVirtualFile=file://D:/Example/automated-tests/Resources/iOS-res.robot, content=com.intellij.psi.AbstractFileViewProvider$PsiFileContent@1bec645b}] file.length=59251; doc.length=59254; node.length=59251; doc.text!=file.text; file name:iOS-res.robot; type:com.millennialmedia.intellibot.psi.RobotFeatureFileType@3da58a27; lang:Language: Robot [Plugin: com.millennialmedia.intellibot] at com.intellij.ide.plugins.PluginManagerCore.createPluginException(PluginManagerCore.java:403) at com.intellij.diagnostic.PluginProblemReporterImpl.createPluginExceptionByClass(PluginProblemReporterImpl.java:12) at com.intellij.diagnostic.PluginException.createByClass(PluginException.java:72) at com.intellij.diagnostic.PluginException.logPluginError(PluginException.java:89) at com.intellij.psi.impl.DocumentCommitThread.assertAfterCommit(DocumentCommitThread.java:721) at com.intellij.psi.impl.DocumentCommitThread.lambda$doCommit$8(DocumentCommitThread.java:704) at com.intellij.psi.impl.PsiDocumentManagerBase.commitToExistingPsi(PsiDocumentManagerBase.java:395) at com.intellij.psi.impl.PsiDocumentManagerBase.lambda$finishCommitInWriteAction$1(PsiDocumentManagerBase.java:367) at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591) at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537) at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59) at com.intellij.openapi.progress.impl.CoreProgressManager.executeNonCancelableSection(CoreProgressManager.java:197) at com.intellij.psi.impl.PsiDocumentManagerBase.finishCommitInWriteAction(PsiDocumentManagerBase.java:362) at com.intellij.psi.impl.PsiDocumentManagerImpl.finishCommitInWriteAction(PsiDocumentManagerImpl.java:145) at com.intellij.psi.impl.PsiDocumentManagerBase$1.run(PsiDocumentManagerBase.java:323) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:994) at com.intellij.psi.impl.PsiDocumentManagerBase.finishCommit(PsiDocumentManagerBase.java:330) at com.intellij.psi.impl.DocumentCommitThread.lambda$createFinishCommitInEDTRunnable$5(DocumentCommitThread.java:488) at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:82) at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:106) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:433) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:416) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:399) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:824) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:773) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:412) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:704) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:411) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

If needed, I can create a gif with the procedure.

lte2000 commented 4 years ago

This issue was detected long ago, exception happen 100% if you just type ${} It have been fixed in dev-0.10.143.384. But your exception info is not same as mine, so can you have a try?

zastress commented 4 years ago

dates

In this scenario the plugin did not crash. You can see the "yellow" section that remains displayed after closing the brace. However, there are situations where it crashes and the log is the one declared in the bug. I got this this morning and I was surely using version 384.

I will try to find the 100% reproducibility procedure and keep you posted.

zastress commented 4 years ago

The yellow section is caused by the NON-Ascii inspection in Pycharm. Disabling that gets read of the section.

zastress commented 4 years ago

@lte2000 I am not a developer, I am a QA automation that uses Robot Framework and intellibot alot. Because I don't have any other way of reaching you, I will post this message here so you know what is my approach.

First of all, I very much appreciate the fact that you took over the development of this plugin and I do belive that it's going to be much appreciated in the community. If you like, we can work together to have it updated with the latest features in Robot Framework (per example I can write issues regarding functionalities and other stuff that need to be implemented and you work your magic from a development point of view). If that sounds good, maybe we can exchange contact information or something so we can work together better and closer.

lte2000 commented 4 years ago

@zastress I'm a user of Intellibot too. I havn't worked with RobotFramework for years, but now I need pick it up again. To restart use Intellibot, I just want clean up some pain point I ever suffered before. So I decide to do some exercise myself. Developing the plugin is not my purpose. Utilizing the plugin to develop test library and keyword is my target. But if there're something can improve the efficency, I'm happy to do so.

For the issue you detected, I can reproduce it but without crash. When you type "${" in variable table, it try to seek the matched "}". In your example, it will reach the end of file. So you will see NON-Ascii in identifier inspection result. After you type "}", the remaining content until the end of file need be reparsed. The time needed depend on the hardware and file size. That's why you can observe the "yellow" section sustained for certain period.

I have fixed in dev_0.10.143.385. Please upgrade and try.

zastress commented 4 years ago

Ok, great. I am up to date with Robot so I will create some issues for solving new syntax demands and other stuff if that's ok with you. Per example, the new FOR, ELSE syntaxes that are not yet recognized by the plugin

zastress commented 4 years ago

Issue is fixed in dev_0.10.143.385