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:
  1. Added AbcFileSystem extending ArchiveFileSystem and registered it.
  2. 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?
  1. Implement `IndexedRootsProvider` (IIUC it will make IntelliJ index archives for containing files/classes)
  2. 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?

0
2 comments

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

0

Here's what I mean by 

> the symbol `Some` is not recognized when editing project.

0

Please sign in to leave a comment.