-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Make the "Select environment" prompt when launching a debugger clearer #146338
Comments
|
|
@DanTup I like your suggestion to make it "harder" for a user to create the "wrong" launch.json (or to create a launch.json at all, given that more and more debuggers try to avoid the need for launch.json anyway). ... and I agree that we could use the "debuggers.languages" contribution to determine the "debugger nature" of a workspace folder: Today this information is used to map the active editor contents to a specific debugger (if a user has pressed F5 and no launch.json exists). But we could use the same information to determine the "language" frequency distribution for the files in a workspace and assume that this results in a ranking for the available debuggers. If this ranking shows a clear winner, we could actually avoid the "Select environment" QuickPick completely and use the same code path that we use for F5 in an active editor (the only difference for the underlying debugger extension would be the missing document URL in this case...) But even if we do not want to avoid the "Select environment" QuickPick, we could change its behavior like this:
@DanTup @roblourens @connor4312 what do you think? |
Both sound good to me. Avoiding the prompt altogether if it can be reliable prevents the user from picking the wrong thing at all. If that's not possible (or not in all cases), then not creating |
@isidorn what do you think about my proposal from above? |
@weinand I like the push towards reducing the wrong automatic creation of While I like your idea to count files and rank debuggers, I am not sure if that would help here. Since both Chrome and Dart are probably interested in same files, so they would most likely be ranked the same. Thus you would still have to ask the user. Or am I missing something? |
This probably isn't the case. Flutter projects will likely only have one (or a very small number) of If there are more That said - it's possible after running the Flutter: New Project command you'll end up with exactly one |
@isidorn in order to verify that my proposal actually works, I did an experiment:
So you are right: Chrome debug would win with 2:1! But I think that could be fixed if Dart would more aggressively capture more web related types. If Dart would just add "html" and "css", it would win with "3:1" ;-) In addition, the second part of my proposal would address this problem: |
btw, the reason users are used to selecting Chrome in a picklist like this, is for Flutter we let you change the target device and since there aren't many UI options in VS Code, it's done via a picker like this:
FWIW, Dart web apps that don't use Flutter are not so common compared to those using Flutter. The Flutter: New Project command is a more interesting case to me which looks like this: Because of the default test created, there are actually two |
As the issue #146956 is closed, allow me to mention our request in this thread: in other words, Is it possible to skip the step of selecting the debugger type and instead provide a list of configurations across all debugger types in the extension? c.c. @jureid |
@elahehrashedi with the strategy sketched above you could contribute |
@weinand yesterday I discussed with C++ and I believe your proposal would not solve their problem. Because they want to contribute I am not sure if there is a good way to solve this for C++. Merging results from multiple debuggers just because they come from the same extension sounds like a workaround. |
@elahehrashedi Is there something like a "main" C++ debugger that is always there and contributes the single "smart" play button that can delegate to the other C++ debuggers? If the answer is "yes" then only this debugger needs to contribute "languages" (and then there will be no selection dialog). If the answer is "no" and all C++ debuggers contribute the same "languages" then you are creating exactly the problem that requires the selection dialog: the same files can be debugged by different C++ debuggers and users will have to pick the debugger they want. |
fyi @bobbrow |
I don't really like this. I don't want to add one file to my workspace, shift the balance, and suddenly get different behavior. Also, counting files in a workspace will be slow. But I like this:
|
I agree, that the second part (the "I like this") is a good first step. But that does not really solve the first problem: many debug extension authors don't like the first part: the "debugger selector". The real "problem" here is that VS Code has one built-in debugger and that always gets into the way when users just want to debug something that is not JS or TS. Python users doesn't care about JS or TS and if they have created a new Python project and press F5 they just want to debug Python. How can we avoid the debugger selector in this case? My proposal tries to eliminate the debugger selector with a heuristics based on the existing static "language" contribution. If it cannot decide clearly what debugger to use it will fall back to the current debugger selector. Delegating the decision what debugger to use back to some pieces of code running in the installed debugger extensions has the problem that too many extension are activated (which will be slow). Do you have a better idea how to tackle this? |
There is no "main" debugger. I believe @WardenGnaw commented on another issue (I forget which) that bundling the different debug types into a single debugger entry makes it difficult for the debugger team to organize their code.
We just want to provide all the launch configurations all the time. If the debuggers we register in |
I don't think it's only the built-in debuggers either. I think debuggers that contribute |
@bobbrow sorry that the term "main debugger" was unclear. I was not suggesting to bundle the different debug types into a single debugger entry. You said:
That's exactly what we are discussing here. Today we need the "select environment" prompt iff..
In this case VS Code does not know what debugger to use, so the "select environment" prompt is needed. Even if we would group the C++ debuggers into one, then we would still have VS Code's builtin JS debugger and would still need the "select environment" prompt. The C++ extension cannot just "bypass" the "select environment" prompt because that would be unfair to all Non-C++ debuggers: users would not have a chance to pick the JS or Python debuggers if C++ "takes them all". Above I've proposed a heuristic to automatically pick a debugger for a given project by matching some project files against file types listed in the "languages" contribution of the debuggers. An alternative would be to let the user use the "select environment" prompt only once per folder/project and then remember the answer. |
@DanTup |
That sounds good. If you need that info from the user anyway, I think prompting for it is a better experience than making them go and add it to launch.json (this is what Dart does for Attach, we use an input box to ask for the VM Service URI so it can just be pasted in and we still don't need to create a launch.json - although we do support it there too). It also gives people an opportunity to "cancel" if they realise it's wrong, without it leaving a permanent
That would also be good IMO (I used PWA as an example as that's what's in the ID, but anything more explicit would probably help).
That sounds good too. Yes it'll only help the first time, but I suspect the number of times people press
That could help too. It's not uncommon for projects to be nested in Dart, but I suspect people with multiple/nested projects are probably not encountering this for the first time, so probably more likely to make the correct selection. It's likely peoples first experience where the most confusion is.
Do you mean that even after other extensions are activated, the earliest one would still be sorted to the top? If so, that sounds great :-) Out of interest, what causes the "suggested" label in your screenshot? Is it just the top one, or does it only appear after that item has been previously selected? Thanks! |
Filed microsoft/vscode-js-debug#1270 to talk about the first part. Sent microsoft/vscode-js-debug#1271 to rename the Chrome/Edge DAs. To explain my change some more - yes, even after other extensions are activated, the ones that were activated before the first debug session still go to the top. The "Suggested" section is these debuggers from extensions that were activated before the first debug session. The next section is everything else. Here's what it will look like in a Dart project. |
* More explicit DA names See microsoft/vscode#146338 * Fix Edge debugger label
Yeah, I've been caught out by those dynamic entries appearing in the Debug side bar dropdown too. I spent some time trying to find a |
* More explicit DA names See microsoft/vscode#146338 * Fix Edge debugger label
@roblourens these are cool improvements 👏 |
Closing this for this month's improvements - can continue in #150663 |
If you press
F5
in a project with no active file, you're prompted to select a debugger like this:This dialog is quite confusing to Dart/Flutter developers, because when they want to run a Flutter app in Chrome, they must not select Chrome at the top, but rather Dart&Flutter. If they do select Chrome, it creates a
launch.json
that has"type": "pwa-chrome"
which means they are not prompted at all the next time they pressF5
, the launch just doesn't do what they'd expect. They need to know to manually go and delete thelaunch.json
to resolve the issue.This has come up a few times:
I think there are some tweaks that would make this clearer and avoid the confusion:
pwa-chrome
. There are entries on the Debug side bar for creatinglaunch.json
, one with default values is pointless and makes it harder to recover from a mistake like thisThe text was updated successfully, but these errors were encountered: