Visual Studio Code

https://code.visualstudio.com&gt; 是 Microsoft <https://microsoft.com&gt; 推出的免费跨平台代码编辑器(不要与 Visual Studio 混淆).

导入项目

  • 官方文件 中找到说明.
  • 文件 > 打开文件夹… .
  • Configure Task. - -
  • tasks.json 文件中找到 "tasks" 数组, 并在其中添加一个新部分: Linux/X11 Windows
    1. { "label": "build", "group": "build", "type": "shell", "command": "scons", "args": [ "-j $(nproc)" ], "problemMatcher": "$msCompile"}
    1. { "label": "build", "group": "build", "type": "shell", "command": "scons", "args": [ // Use this when your default shell is Command Prompt (cmd.exe). "-j %NUMBER_OF_PROCESSORS%", // Use this when your default shell is PowerShell. "-j $env:NUMBER_OF_PROCESSORS" ], "problemMatcher": "$msCompile"}
    tasks.json 的一个例子. 构建系统介绍 以获取完整的参数列表.

    调试项目

    launch.json.
  • 运行 面板.
  • launch.json 文件, 系统会提示你创建一个新的文件.
  • C++ (GDB/LLDB) . 这里可能还有其他特定平台的选项. 如果选择了, 请相应调整所提供的配置示例.
  • launch.json 文件中找到 "configurations" 数组, 并添加一个新部分: X11 X11_gdb Windows
    1. { "name": "Launch Project", "type": "lldb", "request": "launch", // Change to godot.x11.tools.64.llvm for llvm-based builds. "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": false, "preLaunchTask": "build"}
    1. { "name": "Launch Project", "type": "cppdbg", "request": "launch", // Change to godot.x11.tools.64.llvm for llvm-based builds. "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": false, "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "build"}
    1. { "name": "Launch Project", "type": "cppvsdbg", "request": "launch", "program": "${workspaceFolder}/bin/godot.windows.tools.64.exe", // 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": [], "console": "internalConsole", "visualizerFile": "${workspaceFolder}/platform/windows/godot.natvis", "preLaunchTask": "build"}
    launch.json 的例子. 注解 CodeLLDB extension 已经安装。 如果遇到lldb的问题,你可以考虑使用gdb,参阅X11_gdb配置。 为 X11 平台编译(Linux、*BSD 操作系统) 以了解更多信息。 program [程序]下的名称取决于你的构建配置, 例如启用 tools 的64位X11平台 godot.x11.tools.64 . Godot 社区论坛 中寻求帮助.