FindUsages in MultiPsiTree files
Case:
Have a file with 2 psi trees:
- PerlPsi
- PodPsi (documentation, must be as second psi)
Have a word scanners for both perl and pod languages.
Have a reference from element in PodPsi to declaration in PerlPsi and it works fine from usage to declaration. But, declaration can't find usages in second psi.
What should i do to make this work?
请先登录再写评论。
It should work without doing anything special, as long as declaration and reference name are identical and word scanner returns this name as a token. If this is all true, you can try debugging in com.intellij.psi.impl.search.PsiSearchHelperImpl#processPsiFileRoots
These trees are in perl virtual file. So as far as i understand, PerlWordScanner would be used. Which uses Perl lexer, which parses docs as template blocks.
For template data languages, it seems that the following should be in your word scanner (should extend DefaultWordScanner and create lexer and iterate all tokens by itself):
if (YOUR_TEMPLATE_DATA_TOKEN_TYPE == type) {if (!stripWords(processor, fileText, from, to, WordOccurrence.Kind.FOREIGN_LANGUAGE, occurrence)) return;
}
Seems everything works as it is. Was my mistake. Sorry :(