-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
overriding "Run and Debug" button #142019
Comments
@roblourens @weinand I wonder if we can detect if there are run actions (like the separate run & debug actions in the toolbar) if we can render the button differently and use a split button that had the same commands from the run action in the toolbar? I guess this is dependent on having an actual file open to debug, maybe prompting the user to select a file in that case? |
@misolori yes, your suggestion should be possible. One issue I see with this approach is that the contributed Run/Debug actions have sophisticated "when" clauses that control their visibility based on the editor contents. That means if the wrong file is active in an editor, no actions would show up in the Debug viewlet. And it is not really obvious, that the contents of the Debug viewlet depends on the contents of an editor... To fix this we would have to make the contributed actions smarter and richer so that they can always be visible in the Debug Viewlet and explain in the surrounding text how to use them. I'm not sure whether we want to build logic into VS Code so that it works generically with the existing action contributions or if we want to rely on extension contribution for the debug Viewlet instead. |
@elahehrashedi The extension can't own the behavior of F5, because you may be in a workspace where multiple debug extensions are in play.
I'm not sure what you mean by this, can you explain? |
In 8224, @isidorn mentioned that we don't need to generate tasks.json and launch.json, and can instead provide a dynamic resolveDebugConfiguration that will provide a launch configuration on the fly, linking to this example. Can we do this for F5 if the user doesn't already have tasks.json and launch.json? |
Created an issue to use dynamic debug configuration for F5 rather than generate tasks.json/launch.json if they don't already exist: microsoft/vscode-cpptools#8773 |
@roblourens @weinand When debugging with F5, the debug configs will be written in F5. using vscode.DebugConfigurationProviderTriggerKind.Dynamic in vscode.debug.registerDebugConfigurationProvider doesn't help with skipping writing in the launch.json. |
@elahehrashedi VS Code has two mechanisms that automatically write debug configs into the launch.json (if it doesn't exist):
If you don't want to have your debugger extension write into the launch.json make sure that you don't have "initialConfigurations" in your package.json and that your extension doesn't register a "DebugConfigurationProvider" for the Initial trigger type). |
@weinand
In the same code, by using
|
@elahehrashedi I do not really understand your "scenarios" because you don't provide any details about what the user does and what should happen... I can only explain what the APIs do:
If you just want to start debugging when the user presses F5 (and there is no launch config), your best bet is to register a "resolveDebugConfiguration" and create an in-memory launch config that does the right thing. |
Hi @weinand, Let me see if I can help clarify the "scenarios". Our users have a source file open in the editor that is runnable/debuggable. Scenario 1:
Scenario 2:
What we would like to do is not write to We think we are already doing what you said was necessary to make this work. We call |
@elahehrashedi thanks for the additional information. I understand Scenario 1 and that seems to work fine. So let's focus on Scenario 2: I'm assuming the following detailed scenario:
I've tried this with the Java extension and they fully support the scenario: This proves that it is already possible to achieve the desired behavior for scenario 2. Since my own Mock Debugger shows the same behavior as Java, I've added breakpoints to the The cpp extension registers a QuickPickConfigurationProvider. |
@weinand thank you, I could modify the |
The C/C++ extension has two entry point for "run and debug":
one is the "Run and Debug" button from the debug panel (F5)
and the other one is the debug shortcut button on text editor (fully designed by extension).
Is there a way for extension to override the functionality of F5 to make the two functinality to be the same?
Thank you :)
The text was updated successfully, but these errors were encountered: