Make IntelliJ recognize files from archive of custom type
- Situation: I have a project with a dependency on archive of custom type (`arc.abc`), which contains standard Java/Kotlin files, and nested zip/jar files.
- Task: When using `Some` class in a project (this class is defined in one of files inside `arc.abc`), make this class be recognizable by Intellij (suggest completion for it and lint errors).
- Actions:
- Added AbcFileSystem extending ArchiveFileSystem and registered it.
- Added AbcFileType and registered it
- Result: File from the custom archive is discovered via VF Manager with explicit URI
val url = "abc://" + project.basePath + "/app/libs/arc.abc" + "!/Some.kt"
VirtualFileManager.getInstance().findFileByUrl(url)
But the symbol `Some` is not recognized when editing project.
- Question: I found 2 ways to make this file recognized, which one is recommended one?
- Implement `IndexedRootsProvider` (IIUC it will make IntelliJ index archives for containing files/classes)
- Implement `PsiElementFinder` (e.g. `NonClasspathClassFinder`,
IIUC it will suggest files to IntelliJ)
I saw suggestions on both in this forum and usages of both in OSS plugins. I hope someone, understanding how IntelliJ works holistically, can point me out what is the best direction to choose: IndexedRoot or ElementFinder?
Please sign in to leave a comment.
Here's the dummy plugin project with dummy AbcFileSystem and AbcFileType: github
Here's test project which contains arc.abc as a dependency: github
Previous discussion: forum
Here's what I mean by
> the symbol `Some` is not recognized when editing project.