I'm trying to use the Open APIs and Psi structures to parse Java sources programmatically, i.e. outside of the context of IntelliJ. Looking at the unit test integration hooks of intellij, I got this to work perfectly ... up to point I try to resolve declaration to definitions. From that point, the Psi classes need more information they pull from an intellij project definition (sources, modules, etc) and its services (directory index, etc).
I tried two approaches to this. First one is to setup my own application and project and bootstrap the plugins in that context. Due to the nature of the intellij internals, it is very difficult to cherry pick the right plugins/services. The other approach is to programmatically bootstrap the full IDE, but in command line mode. This shows cumbersome in the way the applications are asynchronously bootstrapped. Moreover a number of unitialized fields or forced class cast break this setup, obviously proven untreaded paths.
Maybe it is just better to cherry pick and initalize a number of necessary services to be able to use resolving in the Psi structures. That would be a third approach.
Could you guys advice at what would be the best way to go about it?