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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot reset the debug environment chosen for a file #172522

Closed
ebousse opened this issue Jan 26, 2023 · 11 comments · Fixed by microsoft/vscode-js-debug#1569
Closed

Cannot reset the debug environment chosen for a file #172522

ebousse opened this issue Jan 26, 2023 · 11 comments · Fixed by microsoft/vscode-js-debug#1569
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@ebousse
Copy link

ebousse commented Jan 26, 2023

Problem

A couple of years ago, a feature (covered in issue #124770) was added to VSCode to remember the last debugging environment chosen when executing a given file without any launch.json. This was a very welcome addition to avoid having to pick an environment at each press of F5 on a file.

However, in a given workspace, there is currently no way to undo such file-environment association. This means that if a user choses the wrong environment on the first debug run, the user is stuck with it. In such a case, I found three ways to "fix" the problem:

  1. close VSCode, rename the working folder, open VSCode in the renamed folder — the new workspace will have no file-environment associations which will allow the user to try again,
  2. rename the file — the new file will have no file-environment association which will allow the user to try again,
  3. create a launch.json file that will override this behavior.

I cannot use Option 3 in my own context of use (which is teaching software development basics to 1st year students, where I need to avoid as much as possible making them modify complex json files). This leaves me Options 1 and 2, which work but are really unsatisfying from a user experience point of view (and my still create confusion in students in my case).

Feature I'd like

A way to simply delete a given file-environment association, for instance with a new command accessible from the palette. There are already many commands to "reset" things (at least for the views), thus I don't think adding a new one will look out of place. This possibility was actually discussed in issue #124770, but discarded.

@roblourens roblourens added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Jan 26, 2023
@roblourens roblourens added this to the Backlog milestone Jan 26, 2023
@roblourens
Copy link
Member

Yeah, I have also run into this and it needs more thinking. But I think in this state you can also expand this and find all the dynamic configs still right? Maybe not exactly the same options though.

image

@roblourens roblourens added the info-needed Issue requires more information from poster label Jan 26, 2023
@ebousse
Copy link
Author

ebousse commented Jan 27, 2023

Yeah, I have also run into this and it needs more thinking. But I think in this state you can also expand this and find all the dynamic configs still right? Maybe not exactly the same options though.

image

If I am correct, the menu you are showing in the screenshot is only available if a launch.json file exists, which at least in my case is an option I need to avoid (as explained in my first message).

But actually this would be a way to solve the problem, UI-wise: to make this menu always available, and to show in the drop-down menu the possible available environments to execute the currently opened file, similarly to the choices appearing with CTRL+F5?

@roblourens
Copy link
Member

I think that once you have debugged something, then you see the menu. I just tried it and that's what I see.

@ebousse
Copy link
Author

ebousse commented Feb 1, 2023

I think that once you have debugged something, then you see the menu. I just tried it and that's what I see.

In my case, running a single file without or with debug does not initialize the pane that gives access to said menu:

Capture.video.du.2023-02-01.10-16-31.webm

I can only make it appear if I create a launch.json. Maybe I am missing something?

(Using VSCode 1.74.3)

@roblourens
Copy link
Member

I need to review the exact criteria for that menu showing up in this situation, this area is a bit tricky, but you also have the link that says "Show all automatic debug configurations" which gives you the ability to pick an option.

@ebousse
Copy link
Author

ebousse commented Feb 2, 2023

you also have the link that says "Show all automatic debug configurations" which gives you the ability to pick an option.

If I try to click on "Show all automatic debug configurations", and to select one of the choices there, I get this error:

Cannot read properties of undefined (reading 'fsPath')

I suppose this is because I don't have any launch.json set up?

Here is a video (jump near the end for the error mentioned above):

Capture.video.du.2023-02-02.09-11-17.webm

@roblourens
Copy link
Member

Ah there is actually an issue there, I can repro it, seems to come from here https://github.com/microsoft/vscode-js-debug/blob/df2210162933263ec92b73eba560e33bec3eca9d/src/ui/debugNpmScript.ts#L123 @connor4312 I guess if findFiles doesn't return anything.

@vscodenpa
Copy link

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2023
@roblourens roblourens reopened this Feb 13, 2023
@roblourens roblourens removed the info-needed Issue requires more information from poster label Feb 13, 2023
@connor4312 connor4312 assigned connor4312 and unassigned roblourens Feb 21, 2023
connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Feb 21, 2023
@connor4312 connor4312 modified the milestones: Backlog, February 2023 Feb 21, 2023
connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Feb 22, 2023
@aeschli
Copy link
Contributor

aeschli commented Feb 23, 2023

What are the steps to verify?

@aeschli aeschli added the verification-steps-needed Steps to verify are needed for verification label Feb 23, 2023
@connor4312
Copy link
Member

  1. Have one .js file open in an otherwise empty folder
  2. In the empty debug view, "Show all automatic debug configurations"
  3. Verify you don't see an error popup when you pick "Node.js..."

@connor4312 connor4312 removed the verification-steps-needed Steps to verify are needed for verification label Feb 23, 2023
@joyceerhl joyceerhl added the verified Verification succeeded label Feb 23, 2023
@ebousse
Copy link
Author

ebousse commented Mar 2, 2023

Thank you for the fix, it does solve the problem in my case!

The only strange thing is that the list now provided when clicking on "Show all automatic debug configurations":

Capture d’écran du 2023-03-02 13-14-20

(which expands like this when choosing "Run current file" :)

Capture d’écran du 2023-03-02 13-14-10

Differs from the list provided when doing "Run without debugging" for the first time:
Capture d’écran du 2023-03-02 13-14-00

@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@roblourens @connor4312 @ebousse @aeschli @joyceerhl @vscodenpa and others