Restart of #70
The references request is sent from the client to the server to resolve project-wide references for the symbol denoted by the given text document position.
I took a stab at this issue today in and made good progress on reducing the memory usage and speeding up indexing times, WIP branch https://github.com/scalameta/metals/compare/master...olafurpg:references.
For the akka build with 220k loc Scala, assuming everything has been compiled, it takes <1s on a cold server to index all SemanticDB files and the resulting index uses 3.5Mb memory. Most reference requests respond around ~10ms on average, with few outliers in the 100-600ms range. Here's VS Code displaying ~6k references to String on a cold server on the first request

The remaining challenge before we can merge that branch is to implement "cascade compilation", to ensure that all relevant build targets in the workspace have been compiled. Currently, Metals only compiles the build target of the open file but for "find references" we need to also compile build targets that transitively depend on that file.
PR adding cascade compilation is up #430, which is a blocking issue before we can add references.
Cascade compilation was merged in #467 so the next step is to add "find references" :)
Pending fix #469
Most helpful comment
I took a stab at this issue today in and made good progress on reducing the memory usage and speeding up indexing times, WIP branch https://github.com/scalameta/metals/compare/master...olafurpg:references.
For the akka build with 220k loc Scala, assuming everything has been compiled, it takes <1s on a cold server to index all SemanticDB files and the resulting index uses 3.5Mb memory. Most reference requests respond around ~10ms on average, with few outliers in the 100-600ms range. Here's VS Code displaying ~6k references to
Stringon a cold server on the first requestThe remaining challenge before we can merge that branch is to implement "cascade compilation", to ensure that all relevant build targets in the workspace have been compiled. Currently, Metals only compiles the build target of the open file but for "find references" we need to also compile build targets that transitively depend on that file.