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

Confusing dialog for contributed launch configs when errors occur #156351

Open
sbatten opened this issue Jul 26, 2022 · 15 comments · Fixed by #157049
Open

Confusing dialog for contributed launch configs when errors occur #156351

sbatten opened this issue Jul 26, 2022 · 15 comments · Fixed by #157049
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues
Milestone

Comments

@sbatten
Copy link
Member

sbatten commented Jul 26, 2022

Testing microsoft/vscode-python#19547

Steps:

  1. Create a basic python script file in a new folder
  2. Have the python extension installed
  3. Go to the debug view container and select the "Show all automatic configurations" option
  4. Choose Python... and File
  5. Open the settings editor
  6. Run the dynamic launch config

🐛 get a dialog about the ${file} variable and a button to open the launch.json

Neither of these apply since you didn't create the launch configuration nor does it exist in the launch.json

@roblourens
Copy link
Member

I think that the message about "open an editor" will make sense to people, they should know what we mean. I can hide the launch.json button though.

@roblourens roblourens added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Aug 3, 2022
@roblourens roblourens added this to the August 2022 milestone Aug 3, 2022
@VSCodeTriageBot VSCodeTriageBot added the unreleased Patch has not yet been released in VS Code Insiders label Aug 4, 2022
@sbatten
Copy link
Member Author

sbatten commented Aug 4, 2022

@roblourens In this case, the user didn't create any configuration. They got this auto configuration when they had the python file open. So they aren't necessarily familiar with the ${file} variable nor what an "editor" is. VS Code is open, so what does open an editor mean? Can we be more explicit? e.g. "A file must be open and ~active for running this configuration. Please open a file and try again".

@VSCodeTriageBot VSCodeTriageBot added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Aug 5, 2022
@roblourens
Copy link
Member

@alexr00 would it make sense to give the variable resolver a mode where it throws alternate error messages that don't assume that variable came from something that the user has control over?

I'm not sure, I think people will still figure out what this means

@roblourens
Copy link
Member

roblourens commented Aug 5, 2022

Or you could put an id/enum field on the errors you throw so that the debug service can swap in its own error message, since @sbatten's example mentions "run this configuration" specifically.

@alexr00
Copy link
Member

alexr00 commented Aug 8, 2022

@alexr00 would it make sense to give the variable resolver a mode where it throws alternate error messages that don't assume that variable came from something that the user has control over?

The variable resolver only knows about variables. I think we always include the variable that failed in the error. Can you check for the specific variable that failed and show your own message based on that?

@roblourens
Copy link
Member

You mean just check whether it shows up in the error message? I don't want to rely on that. I'm looking at these errors:

throw new Error(localize('canNotResolveFile', "Variable {0} can not be resolved. Please open an editor.", match));

@alexr00
Copy link
Member

alexr00 commented Aug 9, 2022

Yes, that's the error I was referring too. If the match from that line is ${file} then you could use your own error message instead of the one from the variable resolver. We can also expand upon the Please open an editor if that would help.

@roblourens
Copy link
Member

match is just getting plugged into the localized error message. I don't think it's safe to rely on a substring in an error message

@alexr00
Copy link
Member

alexr00 commented Aug 10, 2022

@roblourens what do you think about something like this: #157788

If that works for you then I'll add error kinds for other variables, not just file.

@roblourens roblourens reopened this Aug 11, 2022
@roblourens
Copy link
Member

Reopened for me to adopt

@VSCodeTriageBot VSCodeTriageBot removed the insiders-released Patch has been released in VS Code Insiders label Aug 11, 2022
@roblourens
Copy link
Member

Is there anything similar in tasks or any other consumer? A case where an extension generates a config with variables that get resolved, and the user never sees the variables?

@alexr00
Copy link
Member

alexr00 commented Aug 12, 2022

@meganrogge for tasks.

Yes, an extension that provides tasks can include variables in their task. If the user hasn't configured the tasks in tasks.json then you could end up in this situation.

@roblourens
Copy link
Member

I guess the error message still has to be specific to debugging, which is what the user knows about, and we probably can't provide a useful generic error message that doesn't include the specific variable.

@roblourens
Copy link
Member

roblourens commented Sep 12, 2022

Oh no. Sorry for taking so long to try to adopt this but I just learned something - you can't throw custom error types across our IPC. The variable resolver is running in the EH and in the renderer process, any extra properties on the error have just been lost. So I've got to take a look at what that code actually does.

@roblourens
Copy link
Member

Well I should be able to capture the custom error type and send it back as a value, this all goes through the ExtHostDebugService. Should be no problem.

@rebornix rebornix modified the milestones: October 2022, November 2022 Oct 25, 2022
@roblourens roblourens modified the milestones: February 2023, March 2023 Feb 21, 2023
@roblourens roblourens modified the milestones: March 2023, April 2023 Mar 21, 2023
@roblourens roblourens modified the milestones: April 2023, May 2023 Apr 26, 2023
@roblourens roblourens modified the milestones: May 2023, June 2023 May 31, 2023
@roblourens roblourens modified the milestones: June 2023, Backlog Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants