ris58h / WebCalm

Free JavaScript and CSS support in IntelliJ-based IDEs
https://plugins.jetbrains.com/plugin/21826-webcalm
31 stars 4 forks source link

JavaScript Lexer exception #1

Closed ris58h closed 1 year ago

ris58h commented 1 year ago

Steps to reproduce:

  1. Open example.js.
  2. Add a new line at the very beginning of the file.
  3. Type '`' (backtick) two times.

https://github.com/ris58h/WebCalm/assets/511242/21385439-90ef-42ce-af96-85ebed9eaa17

com.intellij.openapi.editor.ex.util.LexerEditorHighlighter$InvalidStateException: com.intellij.openapi.editor.ex.util.LexerEditorHighlighter(ris58h.webcalm.javascript.JavaScriptLexer): Error updating  after DocumentEventImpl[myOffset=0, myOldLength=1, myNewLength=0].
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.documentChanged(LexerEditorHighlighter.java:340)
    at com.intellij.openapi.editor.impl.DocumentImpl.changedUpdate(DocumentImpl.java:909)
    at com.intellij.openapi.editor.impl.DocumentImpl.updateText(DocumentImpl.java:813)
    at com.intellij.openapi.editor.impl.DocumentImpl.deleteString(DocumentImpl.java:576)
    at com.intellij.diff.util.DiffUtil.deleteLines(DiffUtil.java:1001)
    at com.intellij.diff.util.DiffUtil.applyModification(DiffUtil.java:1048)
    at com.intellij.openapi.vcs.ex.DocumentTracker.partiallyApplyBlocks(DocumentTracker.kt:238)
    at com.intellij.openapi.vcs.ex.LineStatusTrackerBase$runBulkRollback$1.invoke(LineStatusTrackerBase.kt:262)
    at com.intellij.openapi.vcs.ex.LineStatusTrackerBase$runBulkRollback$1.invoke(LineStatusTrackerBase.kt:39)
    at com.intellij.openapi.vcs.ex.LineStatusTrackerBase$Companion$updateDocument$2.run(LineStatusTrackerBase.kt:307)
    at com.intellij.diff.util.DiffUtil.lambda$executeWriteCommand$23(DiffUtil.java:1528)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:220)
    at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177)
    at com.intellij.diff.util.DiffUtil.lambda$executeWriteCommand$24(DiffUtil.java:1523)
    at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1000)
    at com.intellij.diff.util.DiffUtil.executeWriteCommand(DiffUtil.java:1523)
    at com.intellij.diff.util.DiffUtil.executeWriteCommand(DiffUtil.java:1539)
    at com.intellij.openapi.vcs.ex.LineStatusTrackerBase$Companion.updateDocument(LineStatusTrackerBase.kt:307)
    at com.intellij.openapi.vcs.ex.LineStatusTrackerBase.updateDocument(LineStatusTrackerBase.kt:139)
    at com.intellij.openapi.vcs.ex.LineStatusTrackerBase.runBulkRollback(LineStatusTrackerBase.kt:261)
    at com.intellij.openapi.vcs.ex.LineStatusTrackerBase.rollbackChanges(LineStatusTrackerBase.kt:248)
    at com.intellij.openapi.vcs.ex.RollbackLineStatusAction.rollback(RollbackLineStatusAction.java:40)
    at com.intellij.openapi.vcs.ex.RollbackLineStatusAction.rollback(RollbackLineStatusAction.java:48)
    at com.intellij.openapi.vcs.ex.LocalLineStatusTrackerImpl$LocalLineStatusMarkerRenderer$RollbackLineStatusRangeAction.actionPerformed(LineStatusTracker.kt:130)
    at com.intellij.openapi.vcs.ex.LineStatusMarkerPopupRenderer$RangeMarkerAction.actionPerformed(LineStatusMarkerPopupRenderer.java:220)
    at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:281)
    at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:209)
    at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:177)
    at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:160)
    at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:477)
    at java.desktop/java.awt.Component.processEvent(Component.java:6417)
    at java.desktop/java.awt.Container.processEvent(Container.java:2263)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5027)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2321)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2307)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4859)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:778)
    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.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:751)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:749)
    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:748)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:976)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:911)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:840)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:454)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:773)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:453)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:822)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:507)
    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)
Caused by: java.util.EmptyStackException
    at org.antlr.v4.runtime.Lexer.popMode(Lexer.java:192)
    at org.antlr.v4.runtime.atn.LexerPopModeAction.execute(LexerPopModeAction.java:58)
    at org.antlr.v4.runtime.atn.LexerActionExecutor.execute(LexerActionExecutor.java:168)
    at org.antlr.v4.runtime.atn.LexerATNSimulator.accept(LexerATNSimulator.java:366)
    at org.antlr.v4.runtime.atn.LexerATNSimulator.failOrAccept(LexerATNSimulator.java:299)
    at org.antlr.v4.runtime.atn.LexerATNSimulator.execATN(LexerATNSimulator.java:230)
    at org.antlr.v4.runtime.atn.LexerATNSimulator.matchATN(LexerATNSimulator.java:156)
    at org.antlr.v4.runtime.atn.LexerATNSimulator.match(LexerATNSimulator.java:111)
    at org.antlr.v4.runtime.Lexer.nextToken(Lexer.java:141)
    at JavaScriptLexerBase.nextToken(JavaScriptLexerBase.java:75)
    at org.antlr.intellij.adaptor.lexer.ANTLRLexerAdaptor.advance(ANTLRLexerAdaptor.java:194)
    at com.intellij.openapi.editor.ex.util.ValidatingLexerWrapper.advance(ValidatingLexerWrapper.java:73)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.incrementalUpdate(LexerEditorHighlighter.java:289)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.documentChanged(LexerEditorHighlighter.java:332)
    ... 65 more
ris58h commented 1 year ago

Related to https://github.com/antlr/grammars-v4/issues/3518