-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load extensions from DevTools server instead of using stubs. #6097
Conversation
packages/devtools_app/lib/src/extensions/extension_service.dart
Outdated
Show resolved
Hide resolved
packages/devtools_app/lib/src/extensions/extension_service.dart
Outdated
Show resolved
Hide resolved
var fileUri = await serviceManager.rootLibraryForSelectedIsolate(); | ||
if (fileUri == null) return null; | ||
|
||
if (fileUri.endsWith('/lib/main.dart')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the root library isn't main.dart
? There's no requirement for the entry point of a Dart or Flutter program to be in main.dart
. I'm not even sure there's a requirement for it to be in a library of the form lib/<script>
for Flutter, but there definitely isn't for Dart programs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a convention for finding the root directory that contains the .dart_tool
folder? Is this guaranteed to always be the parent of lib/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, especially if you don't have access to the FS. If you did, you'd just walk the directory chain until you found the directory containing .dart_tool
.
I think you're probably safe to assume that the entrypoint is under lib/
, so if you update this to fileUri.endsWith(RegExp(r'\/lib\/[^\/.]*.dart'))
this should work the vast majority of the time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally, I could just pass the whole root library to the server and have the server look for the .dart_tool folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd be the most accurate way of handling it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used the regexp for now but added a todo to move this logic to the server.
#6094 needs to land first before this can land.
Work towards #1632