IDEA plugin exception

Hi,

I implemented a little plugin which must just highlight text, but when I edit the text IDE throws the below exeption:

[  77963]  ERROR - l.source.text.BlockSupportImpl - View provider com.intellij.psi.SingleRootFileViewProvider@16487bd refused to parse text with Language: TEXT; base: Language: ASN; copy: Language: ASN; fileType: idea.plugin.asn.file.ASNFileType@1cf4363 java.lang.Throwable      at com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)      at com.intellij.psi.impl.source.text.BlockSupportImpl.a(BlockSupportImpl.java:196)      at com.intellij.psi.impl.source.text.BlockSupportImpl.a(BlockSupportImpl.java:146)      at com.intellij.psi.impl.source.text.BlockSupportImpl.access$000(BlockSupportImpl.java:52)      at com.intellij.psi.impl.source.text.BlockSupportImpl$2.run(BlockSupportImpl.java:96)      at com.intellij.psi.impl.PsiManagerImpl$3.compute(PsiManagerImpl.java:212)      at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:117)      at com.intellij.psi.impl.PsiManagerImpl.performActionWithFormatterDisabled(PsiManagerImpl.java:210)      at com.intellij.psi.impl.source.text.BlockSupportImpl.reparseRange(BlockSupportImpl.java:94)      at com.intellij.psi.impl.PsiDocumentManagerImpl.commit(PsiDocumentManagerImpl.java:450)      at com.intellij.psi.impl.PsiDocumentManagerImpl$1.run(PsiDocumentManagerImpl.java:245)      at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:748)      at com.intellij.psi.impl.PsiDocumentManagerImpl.a(PsiDocumentManagerImpl.java:232)      at com.intellij.psi.impl.PsiDocumentManagerImpl.commitDocument(PsiDocumentManagerImpl.java:226)      at com.intellij.psi.impl.PsiDocumentManagerImpl.commitAllDocuments(PsiDocumentManagerImpl.java:195)      at com.intellij.codeInsight.daemon.impl.TextEditorBackgroundHighlighter.getPasses(TextEditorBackgroundHighlighter.java:84)      at com.intellij.codeInsight.daemon.impl.TextEditorBackgroundHighlighter.createPassesForEditor(TextEditorBackgroundHighlighter.java:127)      at com.intellij.codeInsight.daemon.impl.TextEditorBackgroundHighlighter.createPassesForEditor(TextEditorBackgroundHighlighter.java:35)      at com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl$2.run(DaemonCodeAnalyzerImpl.java:582)      at com.intellij.util.Alarm$Request$1.run(Alarm.java:226)      at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:319)      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)      at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:621)      at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:511)      at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:372)      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)      at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) [  77964]  ERROR - l.source.text.BlockSupportImpl - IntelliJ IDEA 9.0.1  Build #IU-93.94 [  77964]  ERROR - l.source.text.BlockSupportImpl - JDK: 1.6.0_16 [  77964]  ERROR - l.source.text.BlockSupportImpl - VM: Java HotSpot(TM) Client VM [  77964]  ERROR - l.source.text.BlockSupportImpl - Vendor: Sun Microsystems Inc. [  77964]  ERROR - l.source.text.BlockSupportImpl - OS: Windows 7 [  77964]  ERROR - l.source.text.BlockSupportImpl - Last Action: NewFile


And one more as well:

[  30414]  ERROR - enapi.editor.impl.DocumentImpl - Wrong offset: 25. Should be in range: [0, 20] Lexer: idea.plugin.asn.lexer.ASNLexer@1812629 java.lang.IndexOutOfBoundsException: Wrong offset: 25. Should be in range: [0, 20] Lexer: idea.plugin.asn.lexer.ASNLexer@1812629      at com.intellij.openapi.editor.ex.util.LexerEditorHighlighter.documentChanged(LexerEditorHighlighter.java:150)      at com.intellij.openapi.editor.impl.DocumentImpl.a(DocumentImpl.java:497)      at com.intellij.openapi.editor.impl.DocumentImpl.access$100(DocumentImpl.java:51)      at com.intellij.openapi.editor.impl.DocumentImpl$1.afterChangedUpdate(DocumentImpl.java:66)      at com.intellij.openapi.editor.impl.CharArray.remove(CharArray.java:83)      at com.intellij.openapi.editor.impl.DocumentImpl.deleteString(DocumentImpl.java:365)      at com.intellij.openapi.editor.actions.BackspaceAction.doBackSpaceAtCaret(BackspaceAction.java:87)      at com.intellij.openapi.editor.actions.BackspaceAction$Handler.executeWriteAction(BackspaceAction.java:61)      at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:52)      at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:748)      at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.execute(EditorWriteActionHandler.java:36)      at com.intellij.codeInsight.editorActions.BackspaceHandler.a(BackspaceHandler.java:91)      at com.intellij.codeInsight.editorActions.BackspaceHandler.executeWriteAction(BackspaceHandler.java:49)      at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:52)      at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:748)      at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.execute(EditorWriteActionHandler.java:36)      at com.intellij.codeInsight.lookup.impl.BackspaceHandler.execute(BackspaceHandler.java:36)      at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:76)      at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:110)      at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:87)      at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:62)      at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:470)      at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:510)      at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.d(IdeKeyEventDispatcher.java:406)      at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:176)      at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:497)      at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:372)      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)      at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)


What's the reason of this exceptions?

Thanks in advance.
Regards,
Oleg.
2 comments
Comment actions Permalink

Hello Oleg,

Please make sure that you specify the correct language for your file element
type (IFileElementType constructor).

Hi,

I implemented a little plugin which must just highlight text, but when
I edit the text IDE throws the below exeption:

 l.source.text.BlockSupportImpl - View provider
> com.intellij.psi.SingleRootFileViewProvider@16487bd refused to parse
> text with Language: TEXT; base: Language: ASN; copy: Language: ASN;
> fileType: idea.plugin.asn.file.ASNFileType@1cf4363
> 
> java.lang.Throwable
> 
>      at
> com.intellij.openapi.diagnostic.Logger.error(Logger.java:48)
> 
>      at
> com.intellij.psi.impl.source.text.BlockSupportImpl.a(BlockSupportImpl.
> java:196)
> 
>      at
> com.intellij.psi.impl.source.text.BlockSupportImpl.a(BlockSupportImpl.
> java:146)
> 
>      at
> com.intellij.psi.impl.source.text.BlockSupportImpl.access$000(BlockSup
> portImpl.java:52)
> 
>      at
> com.intellij.psi.impl.source.text.BlockSupportImpl$2.run(BlockSupportI
> mpl.java:96)
> 
>      at
> com.intellij.psi.impl.PsiManagerImpl$3.compute(PsiManagerImpl.java:212
> )
> 
>      at
> com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePost
> processFormattingInside(PostprocessReformattingAspect.java:117)
> 
>      at
> com.intellij.psi.impl.PsiManagerImpl.performActionWithFormatterDisable
> d(PsiManagerImpl.java:210)
> 
>      at
> com.intellij.psi.impl.source.text.BlockSupportImpl.reparseRange(BlockS
> upportImpl.java:94)
> 
>      at
> com.intellij.psi.impl.PsiDocumentManagerImpl.commit(PsiDocumentManager
> Impl.java:450)
> 
>      at
> com.intellij.psi.impl.PsiDocumentManagerImpl$1.run(PsiDocumentManagerI
> mpl.java:245)
> 
>      at
> com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(A
> pplicationImpl.java:748)
> 
>      at
> com.intellij.psi.impl.PsiDocumentManagerImpl.a(PsiDocumentManagerImpl.
> java:232)
> 
>      at
> com.intellij.psi.impl.PsiDocumentManagerImpl.commitDocument(PsiDocumen
> tManagerImpl.java:226)
> 
>      at
> com.intellij.psi.impl.PsiDocumentManagerImpl.commitAllDocuments(PsiDoc
> umentManagerImpl.java:195)
> 
>      at
> com.intellij.codeInsight.daemon.impl.TextEditorBackgroundHighlighter.g
> etPasses(TextEditorBackgroundHighlighter.java:84)
> 
>      at
> com.intellij.codeInsight.daemon.impl.TextEditorBackgroundHighlighter.c
> reatePassesForEditor(TextEditorBackgroundHighlighter.java:127)
> 
>      at
> com.intellij.codeInsight.daemon.impl.TextEditorBackgroundHighlighter.c
> reatePassesForEditor(TextEditorBackgroundHighlighter.java:35)
> 
>      at
> com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerImpl$2.run(Daem
> onCodeAnalyzerImpl.java:582)
> 
>      at
> com.intellij.util.Alarm$Request$1.run(Alarm.java:226)
> 
>      at
> com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(La
> terInvocator.java:319)
> 
>      at
> java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
> 
>      at
> java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
> 
>      at
> com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:621)
> 
>      at
> com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:511)
> 
>      at
> com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:372)
> 
>      at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThrea
> d.java:269)
> 
>      at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.j
> ava:184)
> 
>      at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThrea
> d.java:174)
> 
>      at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
> 
>      at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
> 
>      at
> java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> 
> [  77964]  ERROR - l.source.text.BlockSupportImpl - IntelliJ IDEA
> 9.0.1  Build #IU-93.94
> 
> [  77964]  ERROR - l.source.text.BlockSupportImpl - JDK: 1.6.0_16
> 
> [  77964]  ERROR - l.source.text.BlockSupportImpl - VM: Java
> HotSpot(TM) Client VM
> 
> [  77964]  ERROR - l.source.text.BlockSupportImpl - Vendor: Sun
> Microsystems Inc.
> 
> [  77964]  ERROR - l.source.text.BlockSupportImpl - OS: Windows 7
> 
> [  77964]  ERROR - l.source.text.BlockSupportImpl - Last Action:
> NewFile ]]>


What's the reason of this exception?

Thanks in advance.
Regards,
Oleg.
---
Original message URL:
http://devnet.jetbrains.net/message/5267250#5267250

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Yes, I think all is correct.


public class ASNParserDefinition implements ParserDefinition {
...


  public IFileElementType getFileNodeType() {
    return ASNElementTypes.FILE;
  }
...

}

public interface ASNElementTypes {
  IFileElementType FILE = new ASNFileElementType();
}

public class ASNFileElementType extends IFileElementType {   public ASNFileElementType() {     super(ASNFileType.ASN_LANGUAGE);   } }

public class ASNFileType extends LanguageFileType {   public static final ASNFileType ASN_FILE_TYPE = new ASNFileType();   public static final Language ASN_LANGUAGE = ASN_FILE_TYPE.getLanguage();      @NonNls   public static final String ASN_DEFAULT_EXTENSION = "asn";   public ASNFileType() {     super(new ASNLanguage());   }   @NotNull   public String getName() {     return "ASN";   }   @NotNull   public String getDescription() {     return "Abstract Syntax Notation";   }   @NotNull   public String getDefaultExtension() {     return ASN_DEFAULT_EXTENSION;   }   public Icon getIcon() {     return null;   } }



0

Please sign in to leave a comment.