Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better no folder debugging #3576

Closed
isidorn opened this issue Sep 24, 2021 · 3 comments
Closed

Better no folder debugging #3576

isidorn opened this issue Sep 24, 2021 · 3 comments
Labels
in debugger Relates to the debug adapter or process of launching a debug session is enhancement
Milestone

Comments

@isidorn
Copy link

isidorn commented Sep 24, 2021

Hi VS Code PM here 馃憢

  1. Purple no folder VS Code -> create a new dart file
  2. Press F5 -> notice how we offer the user to download your extension 馃憦
  3. Now the user presses F5 again and wants to debug, but nothing happens since dart is not supporting no folder debugging

Easiest to do this is to have a dynamic resolveDebugConfiguartion that will provide a launch configuration on the fly. Example

Apart from that consider contributing to the Editor title area menu, such that a Play button would appear in the Editor Title area (picture below). Example how to do this https://github.com/microsoft/vscode-mock-debug/blob/main/package.json#L80

I think both of these are super important and would really love that we improve this experience 馃挴
I see how you are currently relying on being in a folder and generating a launch.json, but hopefully we should be able to simplify that even further.

Let me know if I can help somehow. I am also open to a quick 30 min meeting where we can discuss about the new cool VS Code debug features that dart could potentially adopt.

fyi @DanTup

@DanTup
Copy link
Member

DanTup commented Sep 27, 2021

Thanks for the ping! I think we already do much of the above, although there are some conventions in Dart we look for when trying to decide if the current file is runnable (for example whether it's in a bin, lib folder or tool folder).

This is done so if you're in a Flutter project (whose entry point is at lib/main.dart) and you press F5 with another file open (lib/src/some_implementation_file.dart) we will still run lib/main.dart rather than trying (and failing) to run lib/src/some_implementation_file.dart.

There may be some room to improve things though, such as treating all files as runnable when there's no open workspace, or the open folder doesn't contain a pubspec, or the file is in the root. I'll try some of these out and ensure they don't conflict with any existing behaviour that tries to locate the right entry point.

I am also open to a quick 30 min meeting where we can discuss about the new cool VS Code debug features that dart could potentially adopt.

Sure, if there are new things I might not be aware of I'm interested to hear. I'm on UK time and my calendar is usually fairly clear. You can email me at/send invites to danny@codedconsultants.com.

@DanTup DanTup added in debugger Relates to the debug adapter or process of launching a debug session is enhancement and removed is bug labels Sep 27, 2021
@DanTup DanTup added this to the v3.27.0 milestone Sep 27, 2021
@DanTup DanTup closed this as completed in 57cb4a7 Sep 27, 2021
@DanTup
Copy link
Member

DanTup commented Sep 27, 2021

I added some special cases for no-folder workspace now, so that all Dart files in a no-folder workspace are considered runnable (that is, the Run/Debug button will now show, and resolveDebugConfiguration will treat them as an entry file rather than asking the user to explicitly list one in a launch.json).

Debugging without a folder open won't always give the best experience (for example if main.dart imports foo.dart and you press F5 with foo.dart open it will run that, but perhaps you wanted main.dart) and the recommendation is to follow the normal Pub layout (eg. have an open folder with your entry point at bin/main.dart or lib/main.dart). However, this definitely simplifies getting new users to a run/debug session without needing to initially learn that.

Thanks!

@isidorn
Copy link
Author

isidorn commented Sep 27, 2021

Awesome, thanks a lot for this fast improvement 馃憦
As for the meeting I will follow up in email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in debugger Relates to the debug adapter or process of launching a debug session is enhancement
Projects
None yet
Development

No branches or pull requests

2 participants