intellij-arend
intellij-arend copied to clipboard
Don't use generated PSI in plugin
Arend's PSI tree is in fact a CST, not an AST. It results in a lot off difficulties with this tree: there are some strange nodes like ArendAtomFieldAcc
, and the tree is highly unstable -- any changes in grammar result in a ton of changes in PSI clients.
Grammar Kit allows to delegate the creation of PSI tree to the author of a plugin. It should help us to create user-controlled PSI structure, that inherits Abstract
nodes directly, which should simplify the overall interaction with AST in plugin.
Unfortunately, it requires to make changes almost everywhere in the plugin.
I wanted to do this....
Turns out no one suspected that it is possible. Ironically, I have this approach implemented in my other plugin (https://github.com/JetBrains/intellij-community/blob/master/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/parser/groovy.bnf), and it is fine there. But I thought that Arend has generated PSI for some reason.
Ironically, this will save us lots of time and cleans up many confusing code in intellij-arend if we adapted this approach from the beginning...