there are different flows for span and endpoint discovery for building navigation discovery and document info.
buildDocumentInfo works on a sigle psi file, navugation discovery works on search scope.
the flows can be united into one flow that works on search scope.
write the code in UAST so it will be the same code for java and kotlin