Code/Text completion in IDEA 7
I would like to implement custom completion in comments section with new API.
I found few examples, eg. http://intellij.net/forums/thread.jspa?messageID=5196453� or http://intellij.net/forums/thread.jspa?threadID=266818
However all of them use ReferenceProvidersRegistry and PsiReferenceProvider which are not available in new API.
Can somebody tell me how to start with that? What are the substitutions for ReferenceProvidersRegistry and PsiReferenceProvider in new API?
Please sign in to leave a comment.
Hello Jacek,
What do you mean by "new API"? ReferenceProvidersRegistry and PsiReferenceProvider
are available in 7.0 - they're just not part of the official OpenAPI so you
need to add idea.jar to your project in order to use them.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
I thought that ReferenceProvidersRegistry and PsiReferenceProvider were located in official OpenAPI and disappeared in IDEA 7 but I was wrong.
After adding idea.jar to the project they are visible.
Thank you for the hint Dmitry.
Now I have problem how to implement completion for Java comments.
I tried:
1.
ReferenceProvidersRegistry registry = ReferenceProvidersRegistry.getInstance(project);
registry.registerReferenceProvider(PsiComment.class, new MyReferenceProvider());
but it doesn't work (getReferencesByElement of MyReferenceProvider is not called when I press ctrl+space after word. withing the comment)
2.
CompletionUtil.registerCompletionData(StdFileTypes.JAVA, new MyCompletionData());
doesn't work as well (completeReference of MyCompletionData is not called when I press ctrl+space after word. withing the comment. It is outside the comment)
Any ideas how to implement it for java and javadoc comments?
No answer so I will try to post it as a separate thread. Maybe somebody will find it interesting as well.
Hi Jacek,
in my iBATIS plugin, jetbrains guys create a new api for me, please take a look at the attachment, if you think ok, please use following code:
registry.registerDocTagReferenceProvider(new String[]{"table"}, new JavadocTagFilter("table"), true, new JavadocTableNameReferenceProvider());
Attachment(s):
dc73pj2h_22dk2t4tkg.png