Skip to content

Class cast exception when using language injections #24

@Flynamic

Description

@Flynamic

When injecting my language into other file types such as XML or JSON, the IDE throws an error everytime I type:

class com.intellij.psi.impl.source.xml.XmlTextImpl cannot be cast to class org.antlr.intellij.adaptor.psi.ScopeNode
java.lang.ClassCastException: class com.intellij.psi.impl.source.xml.XmlTextImpl cannot be cast to class org.antlr.intellij.adaptor.psi.ScopeNode (com.intellij.psi.impl.source.xml.XmlTextImpl is in unnamed module of loader com.intellij.util.lang.PathClassLoader @67b64c45; org.antlr.intellij.adaptor.psi.ScopeNode is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @5466ba6)
	at org.antlr.intellij.adaptor.SymtabUtils.getContextFor(SymtabUtils.java:51)
	at org.antlr.intellij.adaptor.psi.ANTLRPsiNode.getContext(ANTLRPsiNode.java:53)
	at org.antlr.intellij.adaptor.psi.ANTLRPsiNode.getContext(ANTLRPsiNode.java:31)
	at org.antlr.intellij.adaptor.SymtabUtils.getContextFor(SymtabUtils.java:51)
	at org.antlr.intellij.adaptor.psi.ANTLRPsiNode.getContext(ANTLRPsiNode.java:53)
	at org.antlr.intellij.adaptor.psi.ANTLRPsiNode.getContext(ANTLRPsiNode.java:31)
	at org.antlr.intellij.adaptor.SymtabUtils.getContextFor(SymtabUtils.java:51)
	at org.antlr.intellij.adaptor.psi.ANTLRPsiNode.getContext(ANTLRPsiNode.java:53)
	at org.antlr.intellij.adaptor.psi.ANTLRPsiNode.getContext(ANTLRPsiNode.java:31)
	at com.intellij.psi.util.PsiTreeUtil.getContextOfType(PsiTreeUtil.java:570)
	at com.intellij.lang.javascript.intentions.JSIntroduceVariableIntention.findExpression(JSIntroduceVariableIntention.java:149)
	at com.intellij.lang.javascript.intentions.JSIntroduceVariableIntention.isAvailable(JSIntroduceVariableIntention.java:180)
	...

This seems to get triggered by JavaScript code insights.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions