What does this do?
It lets you write a quick sequence of commands/scripts to automate VS Code tasks. Example sub-actions are; running command line commands, opening a debugging session, pushing git changes, renaming many files, creating smart snippets, formatting the current file and more.
What are some use-case examples?
- A run command that opens up a terminal, starts an SSH connection, and then runs commands on the SSH server
- A new-project command that goes to where ever you typically save projects, uses the GUI to ask for the name of the project, creates the folder, creates a .gitignore with your preferences, runs an init command, and then opens the folder in your current VS Code window.
- A command that opens a project folder, pulls the latest changes, opens several files in that folder, and then displays the recent changes in those files.
- A folder-specific start command, that pulls the latest changes, installs dependiences, formats files, and then opens the debugger with a specific file.
How do I use it?
- Find the name of commands you want to run
Do can do this by going to the VS Code keybindings.json
(go to gear-icon -> keybindings, then press the {}'s in the top right corner)
All of the
"command":
's can be copied and pasted into the macro - Open up your VS Code settings.json and create a new section like this: (go to gear-icon -> settings, then press the {}'s in the top right corner)
"macros":
- To run the macro open the command pallet (cmd+shift+P or ctrl+shift+P) and type
run macro
then pick which one you want to run. - Create a keybinding to the macro (*its different from normal keybindings) Open up your VS Code keybindings.json, add the name of the macro you just made to a keybinding NOTE: VS Code will tell you the command is invalid, ignore that and save it anyways (see https://github.com/jeff-hykin/macro-commander/issues/1#issuecomment-505951698 as to why)
Now whenever those keys are pressed, the macro commands will execute
What are some macro examples?
See also Level up your Coding with Macros
"macros":
Who made this?
The original extension was made by geddski
I modified it to be synchronous, have javascript support, and allow named execution