Simple launch config
In most instances, you will need to specify a "Launch Configuration" for VS Code. These are commonly referred to as "Launch Configs". This is a file that specifies how VS Code should run your project.
The exercise in the folder "2-launch-configs" is a project written in TypeScript. It is also a console application. If you try and run it, it will run, but it won't appear to do anything. This is because by default, VS Code runs console applications on an "internal" terminal that you can't see. We need to configure VS Code to run this app correctly so we can use and debug it.
First Tab
Second Tab
Open the "2-launch-configs" project. Add a launch config to this application that instructs VS Code to use the "integrated" terminal.
Add a breakpoint to the application. Run it with VS Code and hit the breakpoint.
    Press Cmd/Ctrl + Shift + D to the Debug Sidebar view
    Open the Dropdown List at the top and select "Add Config (2-launch-configs)..."
    Select "Node.js"
    A folder called ".vscode" will be added to the project "2-launch-configs"
    Inside that folder will be a file called "launch.json". This file will be opened automatically by the editor.
    Change the name to "Start Project 2"
1
"name": "Start Project 2"
Copied!
    Change the "program" value to "${workspaceFolder}/index.ts"
1
"program": "${workspaceFolder/index.ts"
Copied!
    Underneath "outFiles", add a line that tells VS Code to use the integrated terminal
1
"console": "integratedTerminal"
Copied!
    Make sure that "Start Project 2" is selected in the dropdown list at the top of the Debug view and press the green arrow
    The application will run and the integrated terminal will open
    In the "index.ts" file, put a breakpoint on line 13
    Enter a color value in the terminal and see that the breakpoint is hit
Note that no special configuration is required for VS Code to handle TypeScript files. If you want VS Code to build or watch/build your TypeScript, press Cmd/Ctrl + Shift + B and select "watch" or "build".
Last modified 2yr ago
Copy link