Visual Studio Code

Visual Studio Code is a free cross-platform IDE by Microsoft (not to be confused with Visual Studio).

Projekt importieren

  • Make sure the C/C++ extension is installed. You can find instructions in the official documentation.
  • From the Visual Studio Code's main screen open the Godot root folder with File > Open Folder....
  • Press Ctrl + Shift + P to open the command prompt window and enter Configure Task.
../../../_images/vscode_configure_task.png
  • Select the Create tasks.json file from template option.
../../../_images/vscode_create_tasksjson.png
  • Then select Others.
../../../_images/vscode_create_tasksjson_others.png
  • Within the tasks.json file find the "tasks" array and add a new section to it:
{
  "label": "build",
  "type": "shell",
  "command": "scons",
  "group": "build",
  "args": [
    "platform=x11", // Change to your current platform
    "target=debug",
    "-j4"
  ],
  "problemMatcher": "$msCompile"
}
../../../_images/vscode_3_tasks.json.png

An example of a filled out tasks.json.

Die Argumente können je nach Einrichtung und Anforderungen unterschiedlich sein. Eine vollständige Liste der Argumente finden Sie unter Einführung in das Buildsystem.

Debuggen des Projekts

To run and debug the project you need to create a new configuration in the launch.json file.

  • Press Ctrl + Shift + D to open the Run panel.
  • If launch.json file is missing you will be prompted to create a new one.
../../../_images/vscode_1_create_launch.json.png
  • Select C++ (GDB/LLDB). There may be another platform specific option here. If selected, adjust the configuration example provided accordingly.
  • Within the launch.json file find the "configurations" array and add a new section to it:
{
  "name": "Launch",
  "type": "cppdbg",
  "request": "launch",
  // Change the path below to match your current platform.
  "program": "${workspaceFolder}/bin/godot.x11.tools.64",
  // Change the arguments below for the project you want to test with.
  // To run the project instead of editing it, remove the "--editor" argument.
  "args": [ "--editor", "--path", "path-to-your-godot-project-folder" ],
  "stopAtEntry": false,
  "cwd": "${workspaceFolder}",
  "environment": [],
  "externalConsole": true,
  "MIMode": "gdb",
  "setupCommands": [
    {
      "description": "Enable pretty-printing for gdb",
      "text": "-enable-pretty-printing",
      "ignoreFailures": true
    }
  ],
  "preLaunchTask": "build"
}
../../../_images/vscode_2_launch.json.png

An example of a filled out launch.json.

The name under program depends on your build configuration, e.g. godot.x11.tools.64 for 64-bit X11 platform with tools enabled.

Wenn Sie auf Probleme stoßen, bitten Sie um Hilfe in einem von Godots Community-Kanälen.