Skip to main content

How to Effectively Use Visual Studio Code as Godot's Editor

One of the annoying things I have to do when I perform a complete format of my system is make VS Code work nicely with Godot once again.

I haven't found a proper article that lists all the changes I need to make in order to have a decent developer experience, so this is going to be exactly that.

Visual Studio Code Extensions

I personally use two extensions for Godot:

The first one is a general extension that improves the integration between Godot and Visual Studio Code. It supports many features, from syntax highlighting to debugging and autocompletions.

Godot Files mostly improves syntax-coloring for files supported by Godot, such as .gdshaders. As of right now, I'm still testing it, but I'd recommend you give it a try.

Run the following two commands in VSCode's command palette (Ctrl + P) in order to install them:

ext install geequlim.godot-tools

ext install alfish.godot-files

Change the following godot-tools settings:

  • Editor Path: Godot3: insert the path to the Godot 3 executable if you use Godot 3
  • Editor Path: Godot4: insert the path to the Godot 4 executable if you use Godot 4

Godot Editor Settings

Inside Godot open Editor > Editor Settings and change the following ones:

  • Network:
    • Language Server:
      • Show Native Symbols in Editor: On
      • Use Thread: On
  • Text Editor:
    • Completion:
      • Idle Parse Delay: 0.1
      • Code Completion Delay: 0.01
      • Add Type Hints: On
    • External:
      • Use External Editor: On
      • Exec Path: the path to the VSCode's executable (hint: if you're on linux you can find it by using whereis code in terminal)
      • Exec Flag: {project} --goto {file}:{line}:{col}
    • Behaviour:
      • Auto Reload Scripts on External Change: On

Static Typing

I think static typing is great, and I try to use it as much as possible, even when languages don't support it or barely do. GDScript is not an exception to this rule.

Inside Godot open Project > Project Settings and change the following ones, be sure you have 'Advanced Settings' on:

  • Debug > GDScript:
    • Unassigned Variable: Error
    • Untyped Declaration: Error
    • Unsafe Property Access: Error
    • Unsafe Method Access: Error
    • Unsafe Cast: Warn
    • Unsafe Call Argument: Error
    • Narrowing Conversion: Ignore

Sources

I didn't come up with most of these changes, so here's a list of links I reference a lot: