-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Allow debug launch configurations to be added dynamically #10861
Comments
Another possibility (which would help greatly with the PowerShell extension) would be to provide a way specify a command or function to be called in the language extension which could dynamically generate the parameters to send as part of launch.json. My language server holds some connection details that are unique for each VS Code window with the PowerShell extension active (TCP port numbers, etc). It'd be nice if the language server could provide that information to the debugger to be passed to the debug adapter without having to manipulate launch.json. I was considering the option to update the launch.json directly for each session using the new configuration APIs but I'd feel a little bad having the user deal with edits to their checked-in launch.json file when they work in a repo shared with other develoeprs. |
From the C# extension's perspective it would be easier to provide the launch configurations that we know about unless the launch.json already exists. If the launch.json is present, we would assume that the user is defining their own configurations and not provide any. Our biggest concern in generating a launch.json is with user modifications. Today, we generate a launch.json for the user when we analyze their project for the first time. However, if the user changes their project, it's now up to them to keep the launch.json in sync. We could re-generate the launch.json, but we would want to detect whether the user has modified it first to avoid stomping on their changes. |
As part of #9061 it is now possibly to modify the launch.json at any time through extension host code. Please try that out and let me know if something is missing for your scenarios - thanks! |
@isidorn, if I understand the work correctly, this means that extensions now have an easier way to modify the launch.json file. This will definitely simplify some of the code we already have in the C# extension to generate that file. However, this particular issue was about being able to provide launch configurations programmatically (i.e. without modifying the file). In our scenario, we already have all of the launch configuration information in the user's project files in a different format. Duplicating this information in a launch.json file and keeping it in sync when the user makes changes is a major headache. Unless I'm missing something, I don't think #9061 addresses our scenario. |
@DustinCampbell thanks for claryfing -> reopening this |
@DustinCampbell are you aware that it is possible to do this and does that help with your scenario? This way you are passing a custom launch configuration to be used instead of modifying the underlying
|
I'm aware of that, but as I understand it, there are limitations:
|
|
'cpp'? Is that a typo? This is the C# extension I'm referring to. |
You can put any type you want there, go, php, c# - whatever debug type your C# extension registers |
@isidorn hmmm, so if an extension registers for |
FWIW, this strikes me as a weird hoop to make extension authors jump through. Also, it's not clear to me how activating the extension on the |
@daviwil currently we only have limited support for this, an extension can be activiated |
The is activated on a handful of events, but primarily |
This is supported now by the startDebug action |
Yes, you said this before, but I'm still not sure how this solves our scenario. Our extension doesn't execute the startDebug command. The user is the one pressing F5. Perhaps I'm missing something, but it's not clear to me at what point we can introduce a custom launch configuration. Could you please clarify? |
I am explaining it in this comment microsoft/vscode-go#745 (comment) Please note that this is |
Thanks, I'll take a look. |
Today, when a C# .NET Core project is opened, the C# extension does a fair amount of work to generate a launch.json file (if none exists already) that matches the current settings in the project. However, if the user changes the launch configurations in their project it gets out-of-sync with launch.json. For C#, the duplication of launch configurations between launch.json and the project files adds a lot of complexity for the user. It might be a better experience for C# developers if the extension were able to provide debug launch configurations to VS Code dynamically when a project is opened or modified.
The text was updated successfully, but these errors were encountered: