sdk
sdk copied to clipboard
`log` completion/fix shows `dart:nativewrappers/_internal/` options
In a Flutter project, write down log. The latest stable (3.32.1), and the previous minor (3.29.3) versions show only two results on completion:
dart:mathanddart:developer.
Now, at the latest master (or on stable when using CTRL + Space but not when writing, can you answer why it differs @DanTup?), two more options show up:
Stable with the keys pressing (CTRL + Space):
Master:
These also show with the quick-fix in both stables I mentioned and at master.
I'd asked on Discord, but I'm opening this issue to make sure we have the answer written somewhere we can find.
Should these other options be there @dcharkes?
CC @bwilkerson
The reason it's showing up in master is that the filtering is done by _PubFilter and shouldInclude first checks uri.isDart and if it is, it checks FileStateFilter.shouldIncludeSdk which returns true because uri.isDartInternal is false. Therefore, this looks like a normal SDK library that should be suggested from.
As for why it didn't show up for you before, I could reproduce this only on the first invocation of completion (my guess is that the out-of-scope pass ran out of budget because it triggered discoverAvailableFiles), but subsequently it also shows up there.
So for me, the behaviour is consistent. I'm not sure what mechanism should be hiding these files. The files are in D:\Dev\Google\Flutter\Flutter stable\bin\cache\pkg\sky_engine\lib\_internal\vm\lib\math_patch.dart for me, and my guess is that they started showing up for Flutter with https://github.com/flutter/engine/pull/50116 which was a change to include these source files in Flutter because otherwise stepping with the debugger would show file-not-found errors.
What's not currently clear to me, is why these wouldn't also show up for standard Dart SDKs though.
These should not be importable using such URIs (e.g. dart:x/y.dart is a not a thing that is supposed to work), so they most certainly should be filtered out one way or another.
@mraleph, I also see similar paths on stack traces:
Unhandled exception:
Can't really do that
#0 whateverYouWant (file:///D:/dev/dart/bug/bin/other.dart:69:3)
other.dart:69
#1 main (file:///D:/dev/dart/bug/bin/other.dart:57:19)
other.dart:57
#2 _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:314:19)
#3 _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:193:12)
Should these be handled differently, somehow, too?
@FMorschel we have been reporting paths like this since forever, so I don't think we are too eager to change these.