Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create custom commands in VSCode?

In Emacs, I can create functions in Lisp language and place them in .emacs file. Those function will become commands that can be called from the editor or bound to keys just like any other built-in command.

Is there a way to do that in VSCode?

Note: The custom commands need to be able to call other commands. Simply using a batch file and running it as a task will not work.

like image 943
Ameen Avatar asked Mar 08 '18 17:03

Ameen


People also ask

How do I create a VS Code template?

In VSCode, open a folder that will contain your new project. Use the Command Palette to execute the command "Project: Create Project From Template". A list of available templates should appear. Select the desired template.


2 Answers

A few marketplace extensions may be of interest:

  • Script Commands by Marcel J. Kloubert
  • multi-command by ryuta46

However in general, you'll need to write an extension to do anything complex.

There's also a VS Code issue tracking support for built-in macros

like image 147
Matt Bierner Avatar answered Oct 18 '22 02:10

Matt Bierner


There's Power Tools by e.GO:digital. It has support for custom commands and event triggers (ie. on file changed), among other things.

like image 3
Michael Pfaff Avatar answered Oct 18 '22 01:10

Michael Pfaff