Open alexr00 opened 4 years ago
I can keep working on this. Just to reiterate (basing myself off this comment), should instancePolicy
provide the following options?
I imagine the first 3 options would also have a restart counterpart.
- terminate the last instance
Yes, let's call it terminateNewest
- terminate the first instance
terminateOldest
- ask which instance to terminate
prompt
? I'm not 100% on this name yet. But this should be the default and use the existing behavior with the notification.
- do nothing and possibly indicate that the instance limit has been reached
I'm not sure which would be more useful here: show no indication that the instance limit has been hit or notify. Maybe we need two options: warn
and silent
I don't think we need any restart options since you are effectively restarting by terminating one of the existing instances.
@alexr00 I'm a little confused about the prompt
option.
This option asks the user which of the N active instances to terminate, correct?
How would this option use the existing behavior with the notification?
So far my understanding for how to handle prompt
would be to open the QuickPick and show all instances of the task, then when an instance is selected it would be terminated.
For prompt
, yes it would be ideal to show the quick pick instead of the notification.
waiting for improve
In the most recent release I am now getting prompted to restart or terminate when I try to run scripts from the NPM Task explorer from two different open working folders (and package.json files) that happen to share the same name. For example, running "start" from workspace folder 1 then trying to also run "start" from workspace folder 2 causes the prompt. I suspect we're not using the full paths to detect # of instances already running.
any update on this? i think there's a clear and common usecase here for running a server -- you want to terminate the previous process and restart so the port is free
My primary scenario is triggering the default build task in VSCode (Cmd+Shift+B
) a lot of times per day but currently I have to terminate the 2 running tasks from the terminal because they even run detached from the app to survive window reloads.
If there was a way to kill these 2 running tasks before starting the new ones that would be very cool 👍
Is this feature already implemented? Or is there any way how to force running task restart automatically when the instance is already running?
Am I missing an option or a tweak to get rid of this pop-up?...
Every time I click run. Surely there's a setting to just terminate the previous one when I want to run a new one without it asking every time. Every time. Like always. I mean I press run a lot. And it asks every time. Maybe we need some AI ML model to train and realize that I press the kill the existing process button after I press the run button every time. Did I mention it prompts every time I click run? Every time... man if I had a penny for every time it prompted me I'd be a rich man... every time. every time.
Related on Stack Overflow: In VS Code, when kicking off a task which is already running, how can the task be automatically restarted?. I'll update my answer there once this is released. Thanks, and keep up the great work!
Work-around: defile multicommand to kill all running tasks:
{ "key": "ctrl+whatever", "command": "extension.multiCommand.execute",
"args": { "sequence": [ { "command": "workbench.action.tasks.terminate", "args": "terminateAll" }, "workbench.action.tasks.build" ] } },
@matklad nice! Note that in VS Code 1.77, you can use the builtin runCommand
command instead of the multicommand extension (see also this). I've updated my answer to the Stack Overflow question to show an example based on your workaround but with my own changes.
No movement a year later? Would love to see this where I'm automatically launching an emulator after a successful build.
Is there keyboard interaction via eg accessibility to access the two buttons? For me the lack of obvious keyboard interactions to initiate the terminate/restart is the real issue. I'd expect the dialog to take focus and the arrow keys to work. Instead I need to worsen my RSI.
Update:
Found a work around shortly after writing this: https://superuser.com/a/1706615
TL;DR: Add the snippet:
{
"key": "ctrl+shift+=",
"command": "notifications.focusToasts"
},
to your keybindings.json. Then ctrl-shift-b, ctrl-shift-=, tab, tab, enter. Far from intuitive and quite laborious, but terminateAll isn't an option for me.
For me, (using hugo), the restart button doesn't even work, since it seems the port isn't free yet by the time vscode tries to start the next instance.
I always get the message "bind: address already in use". Then I have to start it again.
Will this happen soon? Billions of clicks have been spent deciding to Terminate
or Restart
When a task has reached the max number of instances it can have (default is 1, can be changed with
instanceLimit
) theinstancePolicy
determines what happens when another instance is started.History: https://github.com/microsoft/vscode/issues/32264 PR for
insanceLimit
which is relevant to anyone interested in implementinginstancePolicy
: https://github.com/microsoft/vscode/pull/89872