Implementing PsiNameIdentifierOwner for a multi-declaration statement?

Hi,

if i unterstood the References and Resolve chapter[1] in the SDK guide correctly, the usual procedure for implementing the PsiNameIdentifierOwner interface is to implement it for the PsiNode corresponding to a declaration statement, for instance the PsiNode which represents the C declaration "int i;".

But what is the right thing to do if we have statements which declare multiple variables at once, like "int i,j,k;"?
In my PSI tree, this is represented by a single PsiElement node which contains an identifier list.

Or, as opposed to what the SDK guide says, do you rather have to implement it for the child nodes and not for the declaration statement?
I am a bit puzzled here.

[1] https://www.jetbrains.org/intellij/sdk/docs/reference_guide/custom_language_support/references_and_resolve.html

1 comment
Comment actions Permalink

I know two ways:

1. Implement subelements as declarations - i,j,k

2. Implement int i,j,k as psi element with your own interface which can provide a fake named elements with real identifiers. But you'll need to handle your interface by yourself. Platform has no such facility as far as I know. 

0

Please sign in to leave a comment.