Symbol API and mapping from Symbol to PsiElement

Answered

Hi,

I'm trying to write some basic plugin for a custom language but I have not understood exactly how the “Go to declaration” works. I have implemented my `getOwnReferences()`, `getOwnDeclarations()` and my `Symbol` subclass with `equals()`, etc implemented. Do I need to implement and register some service to allow the IDE to map from the `Symbol`s to the `PsiElement`s to navigate correctly?

I got a very simple test with `PsiReference` to work previously and perhaps the Symbol API is not supposed to be used at all by plugin devs?

0
2 comments

Hi,

Please share your implementations.

0

hnisula/cpp2-intellij-plugin at reference-resolver (github.com)

The code is messy as I've been experimenting to try to figure things out. Basically my `Cpp2PsiValueDeclaration` implements `PsiSymbolDeclaration` and my `Cpp2PsiIdentifier` implements `PsiSymbolReference` and both these classes are what the grammar instantiates when building the PSI.

I think a short description of how the mapping between `Symbol` and `PsiElement` is supposed to be done could clarify a lot for me.

0

Please sign in to leave a comment.