Visual Code – Make it possible to Run Program

To configure so that you can run your program without any commands in Visual Code, then you simply need a launch.json file.

Start by creating a folder inside your workspace named .vscode. You can create a workspace by selecting Save Workspace As… in Visual Code under File in the top left corner if you don’t have one already.

Then let’s create a file called launch.json inside .vscode. These configurations will pop up under Run and Debug. This is how my launch.json looks like:

    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit:
    "version": "0.2.0",
    "configurations": [
            "command": "npm run dev",
            "name": "Front end",
            "request": "launch",
            "type": "node-terminal",
            "cwd": "${workspaceFolder}/client",
            "name": "Backend",
            "type": "go",
            "request": "launch",
            "mode": "auto",
            "program": "${workspaceFolder}/backend-server",
            "cwd": "${workspaceFolder}/backend-server",
            "env": {},

Inside my client app package.json:

  "scripts": {
    "dev": "vite",
    "build": "tsc && vite build",
    "preview": "vite preview"

In this case, I got one Frontend application I can run, and one for backend. The front end one is of the type node-terminal, meaning, it can launch node type applications like npm. The important property here is that we have command, which will launch the command npm run dev. This script can be seen from the client package.json above this text. Then the cwd, the path, is specified to the client folder inside the workspace folder where my app is.

The other possible run application is named Backend, and is of the type of Go, where it will launch the program because of the request launch value. Program defined where the program is located.

0 0 votes
Article rating
Notify of

Inline Feedbacks
View all comments