mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-11 14:13:38 +00:00
Cross-file queries waited 5s after the first file was opened. On a cold Metals that is long before it has imported the build, indexed, and — crucially — compiled: references come from SemanticDB, which the build server writes as it compiles, so a query made in between returns some of the references rather than none, with nothing to mark it partial. Against a ~700-file Scala 3 build the first find-references returned 124 of 242. Metals already reports all of this as work-done progress; Serena did not declare `window.workDoneProgress`, so none of it arrived. Declare it, track the tokens, and wait for them before the first cross-file query — the same event-based shape as TypeScript's indexing wait (#1639), whose hooks this uses. Readiness is "nothing outstanding for a moment", not "nothing outstanding": Metals hands off between its phases rather than overlapping them, so the token set empties for around a second between the import ending and indexing starting, and a plain drain returns in that gap. Measured on the same build, the first find-references now returns all 242, taking 32s rather than 22s.