Extending PsiErrorElement

When walking my PSI tree, I can get at PsiErrorElement nodes -- Is there any way (other than parsing the error string) to get at a list of the expected tokens?

For example, PsiErrorElement has an error message:

extends, implements or '{' expected, got 'blah'

I want to get that list, ["extends", "implements", "{"]
Is there any way to do that other than parsing the message? Is there a way to extend how PsiErrorElement nodes get created?

1 comment
Comment actions Permalink

There's no other easy way. In fact, the message depends on the parser and, if it's your custom language, you have control over it. And PsiErrorElements are not meant to be subclassed, sorry.

0

Please sign in to leave a comment.