Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,12 @@ public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Ob
final String dartUrl = urlResolver.getDartUrlForFile(libFile);
// "dart:html" -> "dart-html"
if (dartUrl.startsWith(DartUrlResolver.DART_PREFIX)) {
return "dart-" + dartUrl.substring(DartUrlResolver.DART_PREFIX.length());
String url = dartUrl.substring(DartUrlResolver.DART_PREFIX.length());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to wrap my head around how this change would address flakiness...

Could you help me understand?

Sorry if I'm just being thick!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries... I should have included more information in the PR comments.

Here is an example of the failure in our bots: https://github.com/flutter/dart-intellij-third-party/actions/runs/20836418630/job/59862007406?pr=198

The fix adds a normalization step that truncates the dart: URL at the first slash using substring.

  • Before: dart:core/int.dart -> dart-core/int.dart (mismatching dart-core)
  • After: dart:core/int.dart -> dart-core

This ensures that regardless of whether the resolver returns the library URI or a specific part file URI, the generated documentation key remains consistent (dart-libName), preventing hash/lookup mismatches that caused the test flakiness.

Copy link
Collaborator

@pq pq Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fascinating! So what resolver we get is non-deterministic? Is that why the test only sometimes fails?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also: are we totally sure normalization is the right thing to do? I admit I don't know but my gut is that if a test is flaky, I'd expect a change there and not in the class under test -- unless the flakiness indicates a bug? Do you think that's what's going on?

int slashIndex = url.indexOf('/');
if (slashIndex > 0) {
url = url.substring(0, slashIndex);
}
return "dart-" + url;
}
}

Expand Down
Loading