-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Feature] Support restarting the configuration if it is already running. #1
Comments
Turns out, it's not that simple. First, getting all active debug sessions. The API only exposes the currently active one. So the list would have to be maintained locally using But even then, it can't easily be restarted. Neither the |
Yes, I've come to the same conclusion with respect to restart. Will probably have to ask for an api for
Keeping track of the DebugSessions is certainly workable and is how I envisioned implementing stop/start since |
I did discover a dirty hack that seems to work and the commands could be used in a macro extension command.::
Focusing into the call stack and selecting the next debug session changes the activeDebugSession as reflected in the debug widget dropdown. Thus a Clearly, a proper API is far more desirable but in the meantime... |
@DJ4ddi Please test the latest version v0.6.5 of this extension for your use case. I haven't updated the README yet. There is a new setting with three possible values:
So, if you have some keybinding to start a debug launch configuration, say: {
"key": "alt+g",
"command": "launches.someFile"
}, If that debug session is still running and you trigger the same keybinding again, the setting will be checked and that session will either be stopped (the default), stopped and started again, or restarted. It seems to be working but if don't have a good way of testing the [BTW, how is anyone supposed to figure out the arguments of Also it is weird to be using
and then
for three such related functions ... |
I agree that the VSCode functionality for this is rather... obscure? The 0.6.5 pulled from the store still shows the Settings: "launches": {
"test-debug": "testConfig (ProjectTemplate)"
},
"launch.stopRunningInstance": "restart", Called by task: {
"label": "watch: reload",
"type": "shell",
"command": "${command:launches.test-debug}"
} |
The arguments passed to a command, like
so I had to change a couple of things for that. Please test this now with v0.6.6. BTW, as you can see above I added the ability to add an arg right to the keybinding, this will override the system-wide setting:
I have started to investigate how to get the args from a task as in :
which would also override the workspace-level setting. But although it does properly trigger the command, it only supplies the command name and workspaceFolder as args - so that is going on my TODO list. |
Apologies, it turns out that my folder name was not Overriding the restart behavior per configuration is definitely useful, nice job. Arguments for the task command syntax are always a hassle, not sure how to make that work (I usually circumvent it by defining more specific commands). |
So I assume it works as expected now with your fix? Thanks, I always use TitleCase project names so I missed accounting for spaces. And did the folder name error "launches": {
"test-debug": "testConfig (ProjectTemplate)"
}, arise via intellisense completion or did you manually enter that? |
The auto completion worked fine, it was just a mistake in my comment. And yes, working as expected with the spacebar patch. |
Added the functionality to stop or stop/start or restart a running debug session via a new setting. Added support for a keybinding argument to do the same. Thanks again for all your help on this. In v0.6.7. |
It would be great to allow this extension to restart an active debugging session if the configuration is already running when the command is invoked. See microsoft/vscode#114467 for a possible use case.
This could be done in a setting, e.g.
The text was updated successfully, but these errors were encountered: