-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Keep current configuration when executing a dynamic configuration #10917
Conversation
@alvsan09, could you add some detail to what you mean by this?
What should the launch entry look like? |
@colin-grant-work for the question.
The configurations are not really special, as long as you have two file programs ready to be debugged from an entry in your I have updated the instructions to point to this gist file as well ! |
protected async runConfiguration(configuration: DebugSessionOptions): Promise<void> { | ||
this.debugConfigurationManager.current = { ...configuration }; | ||
this.commandRegistry.executeCommand(DebugCommands.START.id); | ||
await this.commandRegistry.executeCommand(DebugCommands.START.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a more direct strategy might be to modify this code. The DebugCommands.Start
command accepts an optional argument DebugSessionOptions
to be run, and falls back to debugConfigurationManager.current
if none is supplied. Given that, I believe that passing configuration
as a second argument to executeCommand
should successfully run the configuration without modifying the current
field of the debugConfigurationManager
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch Colin!
Since there are two different behaviours when exectuing 'dynamic' vs 'non dynamic' configurations,
I created a new function for 'dynamic', I could inline this call rather than creating a new function although I think it's clearer this way.
Comments are very welcome !
99ff9d4
to
2a9102c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Running a dynamic configuration no longer affects the selection in the debug widget, but does successfully run the config. 👍
2a9102c
to
23e3590
Compare
Re-based to latest master |
Starting a session from a dynamic debug configuration left it selected as `current` in the `DebugConfigurationManager`, however this selection was not reflected in the debug view as the dynamic configurations are not found under the `launch.json` file. Therefore before this change, starting a debug session clicking the `start` button under the debug view may start a previously run dynamic configuration instead of the one reflected in the GUI. This change fixes the above by leaving the current configuration, and specify the configuration to use in an existing optonal argument.
23e3590
to
433f6eb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good to me 👍
I confirmed that both the debug-view, and statusbar reflect the last proper debug configuration executed.
What it does
Starting a session from a dynamic debug configuration left it selected as
current
in theDebugConfigurationManager
, however this selection was not reflected in the debug view since dynamic configurations are not found under thelaunch.json
file.Therefore before this change, starting a debug session by clicking the
start
button under the debug view may start a previously run dynamic configuration instead of the one reflected in the GUI.This change fixes the above problem by saving the
current
configuration before the start of a dynamic debug session andrestores it right after the session starts.
How to test
.ts
program files e.g. A and Blaunch.json
) for each of them (the configurations are arbitrary as long as you have two file programs that are ready for debugging).start
button and make sure that A is started (and not B as before the fix)Review checklist
Reminder for reviewers