Skip to content
Alex D edited this page Oct 14, 2024 · 8 revisions

Compile and Debug with Visual Studio Code

Command line to compile

tsc.exe --di --opt_level=0 --emit=exe example.ts

Compile in Visual Studio Code

  • for Windows file: launch.json
{
	"name": "(Windows) tsc.exe - EXE",
	"type": "cppvsdbg",
	"request": "launch",
	"program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe",
	"args": [
		"-emit=exe",
		"--di",
		"-mtriple=x86_64-pc-windows-msvc",
		"--no-default-lib",
		"C:/example.ts",
	],
	"stopAtEntry": false,
	"cwd": "${workspaceFolder}",
	"environment": [
		{ "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" },
		{ "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" },
		{ "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" },
	]
}
  • for Linux file: launch.json
{
	"name": "(Linux) tsc - Compile",
	"type": "cppdbg",
	"request": "launch",
	"program": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/bin/tsc",
	"args": [
		"--di",
		"--opt_level=0",
		"--emit=exe",
                "--no-default-lib",
		"-relocation-model=pic",
		"~/dev/example.ts"
	],
	"stopAtEntry": false,
	"cwd": "${workspaceFolder}",
	"environment": [
		{ "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/ninja/debug" },
		{ "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" },
		{ "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" }
	]
}, 
Clone this wiki locally