dart-lang / webdev

A CLI for Dart web development.
https://pub.dev/packages/webdev
212 stars 75 forks source link

Expression evaluation fails in global scope #2358

Closed annagrin closed 8 months ago

annagrin commented 8 months ago

Repro

Run a flutter app in VSCode without pausing and try evaluating 'true':

Expected evaluation succeeds with true

Actual

DAP gives an error 'Unable to find the library for file:///...'

image

I looked into it a bit and it seems that SDK Dap expects the results of getScripts to be file uris, but we return package: ones.

@DanTup would it be possible for SDK Dap to unresolve the file uris before looking them up in the results of getScripts? Or should dwds change its output (it might be tricky;)

See: https://github.com/dart-lang/sdk/blob/b4be0315057bb1dd4dca30e991a51cd2ba9a6789/pkg/dds/lib/src/dap/adapters/dart.dart#L1037

targetScriptFileUri is a file: Uri on that line, but I think the callee we expect a package: one.

annagrin commented 8 months ago

/cc @elliette

annagrin commented 8 months ago

Oh, I think @DanTup fixed it in https://github.com/dart-lang/sdk/commit/a95b5841011dfbf888189b13e98df15cf1bc22e9

annagrin commented 8 months ago

Confirmed as fixed, closing!

DanTup commented 8 months ago

Yep, somehow all of my original testing (and automated tests) were using files outside of lib (which always get file URIs) and I missed this 😔

Let me know if you hit any issues when using code with the fix above.