Godot and VSCode: How to integrate them together

Mar. 12, 2024 - (7 months ago)
Last updated Aug. 13, 2024 - 2 months ago.

When I was beginning with Godot, it was fairly daunting. Especially the text editor. It didn't come with a lot of specific features I expect on modern text editors (pseudo IDEs at this point, let's be serious lol). After some time struggling with its internal editor, I finally decided to research ways to use VSCode instead.

Mainly because I love Intellisense. It's the best.

Anyways.

This is the result of my research.

What?

There are a few steps.

  1. Install Godot, and have it in your path
  2. Install VSCode and the godot-tools plugin
  3. Configure the plugin

Easy, right? Let’s dive deeper into it, just in case.

Installing Godot

This step is really important. You need to install Godot to use it, and you want to have it in your path to be able to use godot-tools easily.

On MacOS:

brew install godot # or godot-mono

On Windows, if you have Scoop

# if you don't have git installed
scoop install git
# add the extras bucket, where godot is
scoop bucket add extras
# finally, install godot
scoop install godot # or godot-mono

Either way, if you can run godot --help afterwards, you're good to go.

You’ll want to set these options in your Editor settings at Text Editor > External

Exec Path: Your VSCode executable - on MacOS it’s probably /Applications/Visual Studio Code.app/Contents/MacOS/Electron

Exec Flags: {project} --goto {file}:{line}:{col}

Installing VSCode

You probably have it, but if you don’t this should help: https://code.visualstudio.com

The plugin you’ll need is godot-tools, found here: https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools

It should auto-detect your Godot install given you have it in your path, and when you click on an item in Godot, it should automatically open your project and file in VSCode.

Configuring godot-tools

You probably don’t need to. Though, if you didn’t follow step 1, you will need to change your editor path - it will prompt you in the bottom right corner.

Configuring VSCode

This is optional, but I find having a launch.json in your game dir to be useful, in case you need to launch your game from VSCode.

In your .vscode/launch.json (make it if it's not there) add:

.vscode/launch.json
{
    "version": "2.0.0",
    "configurations": [
        {
            "name": "Launch",
            "type": "godot",
            "request": "launch",
            "project": "${workspaceRoot}",
            "scene": "main",
        },
        {
            "name": "Launch Current Scene",
            "type": "godot",
            "request": "launch",
            "scene": "current"
        }
    ]
}

Note that the Launch Current Scene will launch the current scene based on what file you're currently in. So, if you have a text.gd file or whatever and it's connected to a text.tscn scene, it will launch the scene.

After

You’ll have intellisense, syntax highlighting, and more in VSCode. You can optionally use AI based tools like GitHub Copilot, and other VSCode extensions with your code without weird workarounds.

Sources

I got a large portion of this from this reddit post by u/Elohssa and this blog post by Morris Morrison. Also, the godot-tools github repo helped a lot.

Errata

  • 2024-08-13: Verified and edited Windows instructions to install the 'extras' bucket, and added a note about git.

  • If you have any questions or concerns, please feel free to open an issue. If you just want to say hi, you can find me on my Discord server.