Skip to content

How to run a launch.json configuration in VSCode starts?

Posted in Education, and WhoCodeFirst

In Visual Studio Code (VSCode), you can configure the “launch.json” file to automatically run a specific configuration when the editor starts.

Here are the steps to do this:

  • Open the launch.json file by going to the Debug view in VSCode (View > Debug) and clicking the gear icon in the top-right corner, then selecting “Open launch.json”.
  • In the launch.json file, find the configuration that you want to run when the editor starts. Each configuration is represented by an object with a "name" property. For example, if you have a configuration named “My Configuration”, it will look like this:
{
     "name": "My Configuration",
     // other properties here
 }
  • Add a property called "auto" to the configuration object and set its value to true. For example:
{
     "name": "My Configuration",
     "auto": true,
     // other properties here
 }
  • Save the launch.json file.
  • Restart VSCode. The configuration you specified will automatically run when the editor starts.

Please note that this feature is not available in all version of VSCode.

Also, you can use the “Start with” feature on the debug view, and choose the launch configuration that you want to run at start up.

Happy Learning!

If you enjoyed this article, Get email updates (It’s Free)
Translate »