devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Scripts from pub cache should show package: uris instead of file: uris

Open DanTup opened this issue 6 years ago • 9 comments

This looks weird (and makes the URIs really long), I think they should show package: URIs.

Screenshot 2019-03-14 at 12 58 44 pm

DanTup avatar Mar 14 '19 13:03 DanTup

For some reason, Flutter apps report some specific packages as file: uris, and the rest as package uris. They may be doing something creative with pubspecs for those specific packages?

devoncarew avatar Mar 14 '19 18:03 devoncarew

@bkonyi you previously mentioned there were some known issues with URIs - could this be related? If you open Observatory and review the loaded libraries/scripts for a Flutter app, some of them seem to be package: URIs and some are not.

DanTup avatar Mar 18 '19 15:03 DanTup

I suspect this is either a pub thing, or something very specific to how the deps on these packages are specified by flutter.

devoncarew avatar Mar 18 '19 15:03 devoncarew

@jacob314 Based on the survey you sent out regarding users' uri display preference, do we have a clear choice of what we should display?

kenzieschmoll avatar Jul 23 '19 21:07 kenzieschmoll

Users would prefer package: uris or relative paths from the root of their project so something like packages/package_name/lib/foo.dart

jacob314 avatar Jul 23 '19 22:07 jacob314

The ends of those file:// URIs are cut off - are they all within the lib/ directory of their respective packages?

natebosch avatar Jul 23 '19 22:07 natebosch

Good question! I don't know, but presumably it's possible that loaded scripts from pub cache can be outside of the lib folder? In which case, relative paths from the project root won't work here (they'd end up as ../../../../.pub-cache/hosted/pub.dartlang.org/...) 🤔

DanTup avatar Jul 24 '19 07:07 DanTup

it's possible that loaded scripts from pub cache can be outside of the lib folder

I very much hope not if it is Dart code. It's possible in the case of flutter assets to reference stuff outside of lib. We really don't like that, we'd prefer if lib/ was the only directory usable from outside that package, but there isn't much we can do about it at this point.

If the files are outside of lib/ then we can't construct a package: URI.

natebosch avatar Jul 24 '19 19:07 natebosch

Whoops, I confused myself - I was thinking about scripts in lib/src, which is ofc inside lib 🙈

DanTup avatar Jul 24 '19 19:07 DanTup

Screenshot 2024-11-05 at 2 37 56 PM

We now show package uris when possible

elliette avatar Nov 05 '24 22:11 elliette