How do I add custom references to AutoCompletion?
Hi.
I'm developing cakephp framework plugin.
so, I want to do is things like this image.
Should I use "CompletionProvider#addCompletions" or "ReferencesProvider#registerReferenceProviders" or others?
thanks!
Attachment(s):
AccountController.php_-_candycane_-____www_candycane_-2.png
请先登录再写评论。
I use reference converters registered with @Converter on DOM interfaces. They return specific PSI Reference contributors,
which hprovide lists of candidates. This was enough for code completion and display of error on broken links
Thank you for response!
I did not find the information that would be helpful.
Your reference provider creates reference class for given PSI element (say, attribute value), and this reference class shall implement com.intellij.psi.PsiReference
( Usually you sholr extend PsiReferenceBase ) Usually you have to implement:
Where resolve() delievers PsiElement in question ( or null, in case no missing element is found - in this case error will be shown )
and getVariants() delievers array of candidates for autocompletion ( either plain strings, or LookupElementBuilder - in case you like to have fancy icons etc )
Reference providers are registered by reference contributor, declared in your plugin.xml:
<psi.referenceContributor
implementation="ClaassContributingReferece extends PsiReferenceContributor"/>
where you can bind reference providers to certain psi elements. Loook into struts plugin for inspiration.