fzyzcjy / dart_interactive

REPL (interactive shell) for Dart, supporting 3rd party packages, hot reload, and full grammar
https://github.com/fzyzcjy/dart_interactive
MIT License
221 stars 13 forks source link

Interactive cannot read `lib/auto_generated.dart' when importing a directory #73

Closed nathanielgreen closed 1 year ago

nathanielgreen commented 1 year ago

Describe the bug Interactive doesn't seem to be able to find auto_generated.dart when specifying a directory. It generates one in the local lib at ./lib/auto_generated.dart so either it's searching in the wrong place or adding auto_generated.dart to the wrong directory.

To Reproduce

  1. flutter pub cache clean
  2. flutter pub global activate interactive
  3. dart create -t package test_package
  4. cd test_package/
  5. interactive --directory ./

Expected behavior For interactive to correctly run, generating the auto_generated.dart to the correct directory instead of erroring out.

Logs

nathanielgreen@Nathaniels-MacBook-Pro ~/P/test_package> interactive --directory ./
Run: /usr/local/bin/flutter/bin/cache/dart-sdk/bin/dart [--enable-vm-service=52106, file:///Users/nathanielgreen/.pub-cache/global_packages/interactive/bin/interactive.dart-2.19.2.snapshot, --vm-service-was-enabled, --directory, ./]
The Dart VM service is listening on http://127.0.0.1:52106/Y1O9xQ1GzLY=/
The Dart DevTools debugger and profiler is available at: http://127.0.0.1:52106/Y1O9xQ1GzLY=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A52106%2FY1O9xQ1GzLY%3D%2Fws
Workspace: ./
Unhandled exception:
IsolateSpawnException: Unable to spawn isolate: ../../.pub-cache/hosted/pub.dev/interactive-1.2.1/bin/lib/auto_generated.dart: Error: Error when reading '../../.pub-cache/hosted/pub.dev/interactive-1.2.1/bin/lib/auto_generated.dart': No such file or directory

Desktop (please complete the following information):

Additional context This happens even when activating interactive with dart pub global activate interactive too.

welcome[bot] commented 1 year ago

Hi! Thanks for opening your first issue here! :smile:

fzyzcjy commented 1 year ago

Hmm looks like a bug. Feel free to PR (especially given the codebase is very tiny ;))!

nathanielgreen commented 1 year ago

Sure thing can do, any pointers on where to start?

fzyzcjy commented 1 year ago

Maybe first step is clone the code and run it normally - like running any dart package. Then add logging or debugging to see what's going wrong

The (brief) intro to implementation https://github.com/fzyzcjy/dart_interactive#implementation may also be helpful

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.