creating my own PsiPackage
I am developing a plugin for a framework for C++ & python. The framework has its own packaging system that is completely separate from python, Java, or CMake packages.
These packages are also linked to a directory of some sort like java/python packages.
I have looked into the IntelliJ implementation of the Java packages, PsiPackages, and tried to replicate them in my own plugin, but none of the code I wrote for that was ever touched when I ran the plugin.
So my question is - how do I implement my own version of a package like PsiPackage?
Please sign in to leave a comment.
The question, probably, is not how, but why? What are you trying to achieve?
Hi @Alexandr, thanks for the reply!
As I said in my question, the framework I am making a plugin for, ROS, has a unique packaging system. This "ROS package" is used throughout the plugin in somewhat similar fashion to how Java packages are made.
I need some way to get data from the contents within these packages and make sure they are linked to the package itself. Following are some things I need to use packages for, implemented or not:
First - I need to be able to easily find specific package defining (and other) files.
In the image below are some examples of how ROS packages are built:
The blue marked folders are examples of ROS packages. These packages can either be defined within the same project or outside the project (depending on which directory is marked as the project's root directory).
Each package also has two required files:
I need to be able to easily access the files place within a given package with the ability to do file queries on them (get files with specific name patterns, files within a certain directory, etc.). I also need to easily get the package given a specific file defined within my plugin or extended by it (for example the Msg file you see in here)
Second - I need to know what are the available packages
Following is an example for a message file:
In here two fields are defined: one is a primitive field, but the other is a bit more complicated.
the "msg" field is referencing the "Msg" file located within the "ros_pkg" package. I need to be able to have some list maintained of all avilable packages within and outside my project, and be able to get them via some query. That way I will be able to complete my linking between files via a reference.
Last - I need to know about packages completely outside the source workspace
There are also special compiled packages which are considered library packages for the ROS framework. They are very different from normal packages since they have been built.
These packages are decentralized - they have multiple root directories. Their files are also located differently than in the other source packages.
These packages should behave exactly the same like the source packages. same queries, same memory, same everything. Moreover, when opening one of the files there, they should also be able to query for other packages and reference other compiled packages (they wont reference source packages since if they would have, it would mean the package was never compiled).
These compiled packages also have a user-defined root folder to search from, so indexing them is not too difficult.
All of these three tasks need to be done somehow. The solution I came up with for the problem was using your solution to finding and querying (and suggesting) Java packages. However, I am very open to suggestions on how to better answer the requirements I need to take care of.
Thank you in advance!
As far as I know, there is no some EP to add your own PsiPackage.
If I understand you correctly, you need to introduce some directory-based entities.
As an example: you could make your own service, which going to handle this, some package-manager.
It should find packages by keyfiles and watch vcs roots for changes and update information. Will work like a runtime index.
Hi, sorry for the late reply...
Could you explain (or direct to resources where I can learn) how to make a package manager?
How do I watch and update my packages based on VCS updates? What are keyfiles and how do I use them in the IntelliJ platform?
This is a package manager, not the package manager. So it's up to you how it's going to work.
You may watch a VirtualFileSystem to catch changes. VCS updates can probably be watched too, but isn't it too specific?
Keyfiles are just files which can identify your package, like your `package.xml` or `CMakeList.txt`