Files
sdk/pkg/analysis_server/lib/src/computer
Danny Tuppeny 2bf4d20cd3 [analysis_server] Improve handling of inheritance in LSP Document Highlights
With this change, we collect elements for all supertypes for the element at the supplied position. Then when walking the AST, we check whether each items elements or any of its own supertype elements match against that set.

This should result in all of the items the user would consider "reachable" from the starting location. This does mean some results are not symmetric (see the `fromLeaf` and `fromRoot` tests), but I think they are the most logical. While VS Code currently has a bug related to asymmetric highlights, I believe this will be fixed (because TypeScript also behaves this way).

This does add a little more work, but when walking the AST, we do check the name first as a quick check before we look at any supertypes.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4670

Change-Id: Id2bcdff04c6c7826f8a164ecf99752951f641b8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490960
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2026-03-26 14:30:41 -07:00
..