-
Notifications
You must be signed in to change notification settings - Fork 29.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
Re-run Last Task #25310
Comments
Good suggestion. What you can do right now is to bind a keyboard shortcut to the
|
Thanks for the suggestion @dbaeumer -- Though it doesn't seem to solve the problem I'm looking for. The task I want to re-run is dependent upon both the file and lineNumber. While I'm working in other files I want to keep re-running the previous task and include those previous values and not my current values. Common problem here is red-green testing where I run a failing test first and then modify the main body of code to fix the test. In the current flow I have to keep switching back to the test to run it which is a lot more time intensive than other platforms I've used for the same purpose (sublime and atom both have plugins for it.) |
@nathanpalmer this should have improved as well by VS Code now sorting the task list in a LRU fashion. So running the last task is no Run Task (which you can bind to a keyboard shortcut) and then pressing enter. |
Just tried that, had to arrow down once to hit the last task. However the problem still remains that it takes the parameters of the current file and line I'm on and not for the previous run. So unfortunately it doesn't work as needed. |
Just to clarify. You want to run the task in the same state so with the variables as resolved when last run. Is this correct. |
@dbaeumer i would say 'yes' to that statement. This is my explanation and workaround of the usecase i am (and it seems that @nathanpalmer too) after... |
@dbaeumer Yes, running the last task using the same state including variables. In my use-case it's a unit test as I'm working in other parts of the code I want to quickly re-run that same exact test. Thanks for the suggestion @hendrics. Not exactly a perfect solution as this will run a set of tests instead of a single one. But it's good to hear what others are doing. |
It'd be also great to have another similar command: "Terminal: Rerun Last Command". |
New to VSCode, agree with @thorn0 's suggestion above; wondering how simple it is to make a keybinding, macro, plugin, whatever that achieves the above. effectively |
@thorn0 @deanrather Here is a workaround solution. Step 1: Override the default terminal keybinding from triggering to toggling.
Step 2: Override the F5 key, which can be altered to any key combination as you like. On Unix-like OS with X11, the script below checks the focused window and then send key sequences, which will re-run the last command belonging to the last focused terminal, if the focused window is VSCode; otherwise, the F5 key does what it is supposed to do as usual. There should exist some similar method for other OSes.
Step 3: Register this script in the custom keyboard shortcut, which is in the System Settings on Ubuntu. |
Amazing! Thanks @alexr00 |
Verification steps: Run a task using the Run Task command. Then run the Rerun Task command. Also try specifying runOptions: { reevaluateOnRerun: false } in the task definition and run the Rerun Task command. |
There does not appear to be a way to re-run the previously executed task. You can either run "the build" using
ctrl
+shift
+b
, or you must explicitly select a task to run. In Atom and Eclipse, you can hitF9
to re-run your last build. This is very handy, and easily what I want to do 80%-90% of the time, just re-run my last build/task command. However, vscode does not appear to allow you to map any hot-key to the last build/task command. So if I want to run taskfoo
, I would, effectively, have to typetask foo
into the command pallet every time. Things would go a lot faster if I could just typetask foo
into the command pallet just once, then hit a hot-key to repeat the last task.The text was updated successfully, but these errors were encountered: