Language Support - Indexing language defined classes


Hi !

I have almost finished developing a language plugin. It's minimal but I'm at a stage where I want my code to recognize not only classes defined by me during development, but also classes predefined within the language. How can I achieve this? 

For clarification: language comes with a class called System, which has static functions - bar, foo, etc... When I type System in my code, it of course annotates as an undefined symbol.

Comment actions Permalink


If you have a standard library with sources that could be attached to the project, you can register com.intellij.additionalLibraryRootsProvider extension. See the Javadocs for more information.

You can store your types definitions in some format in the plugin code/resource files and use these definitions for resolving (to FakePsiElement), completing, etc.

You can also consider using Symbol API, but it is in an experimental state, is not documented in detail, and may require efforts to understand how to use it.

Comment actions Permalink

Hi Karol Lewandowski

Thank you for your response. 

I don't have a library, it's a small language so it has couple of predefined classes with a little set of functions each. Could you give me more details or reference to documentation on how to go with the second option? So I can add those predefined classes in plugin resources files and resolve to FakePsiElement? Couldn't find much of helpful examples/documentation about that from my search :/

Comment actions Permalink

Or how do I provide virtual files for SyntethicLibrary source roots? Should I have some files created somewhere in the system and retrieve them in the override of AdditionalLibraryRootsProvider#getAdditionalProjectLibraries method? As I understand from what I searched for, I can't create Virtual Files on the fly without them existing on the disk first. Am I wrong?


Please sign in to leave a comment.