intellij-arend icon indicating copy to clipboard operation
intellij-arend copied to clipboard

Don't use generated PSI in plugin

Open knisht opened this issue 2 years ago • 3 comments

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.

knisht avatar Jul 12 '22 18:07 knisht

I wanted to do this....

ice1000 avatar Jul 13 '22 05:07 ice1000

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.

knisht avatar Jul 13 '22 07:07 knisht

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...

ice1000 avatar Jul 13 '22 18:07 ice1000