Completion for inner classes returned by PsiElementFinder


I want to provide additional Java classes without adding them to FileSystem. What I've done so far:

  1. I've implemented custom PsiElementFinder (methods #findClass, #findClasses). Symbols with qualified names are now recognized `package.ClsName`, but symbols with short names are not `ClsName`.
  2. I've added custom ShortNamesCache. Over the symbols with short names now I receive suggestions to import the class. This quickFix replaces short name with qualified name, even if the class in the same package. `ClsName` is replaced with `package.ClsName`.
  3. I've implemented #getClasses(PsiPackage) in the PsiElementFinder. Now short names are recognized `ClsName` and inner classes are recognized `ClsName.Builder`. But completion works for `ClsName` only, and not for `ClsName.Builder`.
  4. I've found CompletionContributor, but I don't need a custom logic. I want standard Java completion for methods in the `ClsName.Builder` class.
  5. I've also tested it on version 2018.1, and completion for inner classes worked there. But I need a solution for 2019.2. (Android Studio version)


How would I enable completion for `ClsName.Builder`? I've already spent few weeks on this problem, I've tried different combinations of classes returned by Finder and ShortNamesCache, but nothing worked for me.



Sorry for the late reply.

I'm glad that you found the right solution!