Files
sdk/pkg/analysis_server/lib
Danny Tuppeny d3c06c4822 [analysis_server] Fix handling of semantic tokens when roots are being built
This fixes https://github.com/dart-lang/sdk/issues/55889 which is repeat of https://github.com/Dart-Code/Dart-Code/issues/3929 (but semantic tokens was not fixed with that CL).

The issue was when the server was initialized with no roots (for example an empty workspace) and then a new file opened with requests being sent immediately before the roots were updated.

The fix changes from directly calling `server.getResolvedUnit` to instead using `requireResolvedUnit` which handles this situation by waiting for any in-progress context changes and retries.

Fixes https://github.com/dart-lang/sdk/issues/55889

Change-Id: Id078947e5c6665b2afb9e31adc244f16987870f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/369464
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2024-06-03 15:45:56 +00:00
..