SyntheticLibrary, how to connect to a module and scopes

Hello,

As explained here:

AdditionalLibraryRootsProvider Allows providing synthetic/predefined libraries (SyntheticLibrary) in a project without exposing them in the model. By default, they're also hidden from UI.

I created my Modula3SyntheticLibrary class (implementing also ItemPresentation)... and used it to implement an AdditionalLibraryRootsProvider. Everything is scanned as expected, libraries are added and I can browse them in External libraries but not anywhere else. These are not JAR libs. Also, I specified excludedRoots - as a list of files that are not relevant, but they still show. I can double click and open them while browsing in the Project tool window, but ctrl-shift-f is not searching them, FilenameIndex.getFilesByName is not looking them up.

"Hidden from UI" - I understood this as "if not implementing ItemPresentation then not-renderable/not-visible)". Am I correct? Or I still have to extend something somewhere to be able to connect my modules and my external libraries?

Similar code I found in IntelliJ-community has a static method reindexIfNeeded, apparently invoked from some ad-hoc context. Do I have to do some reindex somewhere after I return List<SyntheticLibrary> from my getAdditionalProjectLibraries() method?

TIA,

dd

1 comment
Comment actions Permalink

I have used code from https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000036724-Programmatically-add-directory-based-dependency-library-to-module by Mark Vedder and now my references to library symbols work.

I still do not have libraries listed in ctrl-alt-shift-s (ProjectJdksEditor?). I suppose this is because of ProjectJdksEditor which is Java-specific and it is what is available from the platform? Consequently, I cannot edit libraries in any way.

0

Please sign in to leave a comment.