My plugin (own dsl language parser) doesn't work under Ultimate version of IDEA 12

My plugin works fine under CommunityEdition. But when I install it under Ultimate edition and open associated with my dsl file, it craches with following exception in log:

At the same time file my dsl is opened but everything in it is blurry (even scrollbar), references in text don't work and I can not edit text in window.

2013-09-17 15:59:08,043 [  60798]  ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA 12.1.1  Build #IU-129.239
2013-09-17 15:59:08,043 [  60798]  ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.7.0_17
2013-09-17 15:59:08,043 [  60798]  ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) 64-Bit Server VM
2013-09-17 15:59:08,043 [  60798]  ERROR - com.intellij.ide.IdeEventQueue - Vendor: Oracle Corporation
2013-09-17 15:59:08,043 [  60798]  ERROR - com.intellij.ide.IdeEventQueue - OS: Windows 7
2013-09-17 15:59:08,043 [  60798]  ERROR - com.intellij.ide.IdeEventQueue - Last Action: GotoDeclaration
2013-09-17 15:59:08,756 [  61511]  ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.InvocationEvent[INVOCATION_DEFAULT,runnable=javax.swing.RepaintManager$ProcessingRunnable@7efc393c,notifier=null,catchExceptions=false,when=1379419148756] on sun.awt.windows.WToolkit@1221f459
java.lang.AssertionError: 19
    at com.intellij.openapi.editor.ex.util.SegmentArray.findSegmentIndex(SegmentArray.java:119)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter$HighlighterIteratorImpl.<init>(LexerEditorHighlighter.java:360)
    at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.createIterator(LexerEditorHighlighter.java:118)
    at com.intellij.openapi.editor.impl.IterationState.<init>(IterationState.java:122)
    at com.intellij.openapi.editor.impl.EditorImpl.xyToVisualPosition(EditorImpl.java:1070)
    at com.intellij.openapi.editor.impl.EditorImpl.xyToLogicalPosition(EditorImpl.java:1293)
    at com.intellij.openapi.editor.impl.EditorGutterComponentImpl.paint(EditorGutterComponentImpl.java:198)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5221)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1512)
    at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1443)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1236)
    at javax.swing.JComponent._paintImmediately(JComponent.java:5169)
    at javax.swing.JComponent.paintImmediately(JComponent.java:4980)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:796)
    at javax.swing.RepaintManager$3.run(RepaintManager.java:784)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:784)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:757)
    at javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:706)
    at javax.swing.RepaintManager.access$1000(RepaintManager.java:62)
    at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1651)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:688)
    at java.awt.EventQueue$3.run(EventQueue.java:686)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
    at com.intellij.ide.IdeEventQueue.d(IdeEventQueue.java:686)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:511)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:334)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

3 comments

This exception has nothing to do with IntelliJ IDEA Ultimate. It's caused by a bug in your lexer: the sequence of tokens that you return has a gap (the end offset of the previous token is smaller than the start of the next token). Tokens returned from the lexer must always cover the entirety of the file.

0

Dmitry, thanks for reply. But I totally do not understand what do you mean. Whe does my lexer work excellent when I run my plugin from IDEA, and it doesn't work when it was installed as plugin "install from disk..."?
Can it be somehow related with patched jflex, which is using in OpenAPI?

0

Well, thanks again for your answer, Dmitry.
It was true, I really had gaps in my lexer. It may be helpful for others: I had missed token types for white-space characters, something like that:

...
  {CRLF}                         { yybegin(YYINITIAL); r }
  {WHITE_SPACE}                  { yybegin(YYINITIAL); }
...

- and it is incorrect, it must be:

...
  {CRLF}                         { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; }
  {WHITE_SPACE}                  { yybegin(YYINITIAL); return TokenType.WHITE_SPACE; }
...

But in any case, this is still strange, that when running such sick lexer under IDEA ("Run plugin...") - it works perfectly.

0

Please sign in to leave a comment.