How to implement references to elements not in project?
Hi all,
In my plugin, I have references working correctly. However frequently I'd like to identify symbols that come from the underlying implementation, such as built in functions. The user can't navigate to these symbols since the source code is not available, but otherwise I'd like them to act as normal symbols, i.e. participate in Find Usages. I can't see a way to do this without having a PsiElement for them. Is there a way to do this?
Thanks,
Colin
请先登录再写评论。
Hello Colin,
No, you do need to have PsiElements for the built-in symbols. The way we
usually solve this problem is by generating stubs for built-in functions
as source code in the same language, and including them in the plugin / IDE
distribution.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hi Dmitry,
Ok, thanks. How do I stop users navigating to them, then? And how do I load the source files - as a resource from the plugin jar?
Cheers,
Colin
Hello Colin,
Do you really need to? We don't. :)
Yes, for example. Or put them side-by-side with the plugin jar in the plugin
zip.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hi Dmitry,
Maybe not - it seems a little weird though :-)
Ok, I'll try that. How/when would I load these files?
Thanks,
Colin
BTW is there a public example of this technique I could look at?
Thanks,
Colin
Hello Colin,
You can look at how this works in the Ruby plugin. You don't get to see the
source code, but the principle should be clear from the UI.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"