I'm writing a Mathematica language-plugin. So far the file-registration, the lexer and basic highlighting are up and running. Instead of using the Grammar-Kit for parsing, I hand-crafted a Pratt-Parser since I want to learn something and I hope it fits better the operator-expression like Mathematica-language.
Although the class-structure to parse a great part of the language is already there, I first wanted to understand some details. So far I can correctly parse expression like a+b+c+.. Hooorray. The first thing I noticed is, that I don't know how to exclude certain elements from the Psi-tree. Consider this very small example
As you can see the PsiElement(PLUS) is not required since I know the element-type from the "Plus" node. At which point during the built of the Psi-tree can I prevent the PsiElement(PLUS) to be in the final tree? Or is it required that all leafs stay in the tree because they have a connection to the source-code? Basically I want exactly what is depicted in the last step of this image from the "Custom language documenation":
Maybe I can ask a second question: The only reason for me to build a parser (and a Psi-tree) is that I want to be able to implement some nice features like camel-hump autocompletion and refactoring and advanced highlighting. When I understand this right, then my elements in the Psi tree need to implement certain interfaces, e.g. I assume my identifier-element needs to implement PsiNamedElement in order to support renaming.
Can someone point me to some further documentation? For instance ASTWrapperPsiElement seems to be really helpful but the java-doc is non-existent (in my version of the openapi). Maybe there are discussions here which I just haven't found.