SamuKata
Octodemy
Octodemy

patreon


Experimenting with gdscript in VSCode (update)

Can you spot the differences?

I've been having some problems with autocomplete using autoload variables so I decided to try using VSCode with gdscript.

The VSCode Godot-tools Extension

It is very easy to setup and start using Godot with VSCode.

Auto complete work out-of-the box. And it's very easy to setup the debugger.

It also has some nice extra features. You can even see the scene's tree structure inside it.

Then we have the 'Godot files' extension, that adds popups for external resources.
Which is great if you have the edit scene and resource files directly.


Sadly, it doesn't work on actual preloads inside .gd files

The color theme

'godot-vscode-theme' adds a very familiar interface to vscode.

It is close, but a few colors are not quite correct.

I tried to change it to fix some colors.

But there are some special things Godot does that I don't think its possible with simple themes. Like coloring global and local functions differently.

I initially couldn't change the 'annotation'. They color id I found was tied to the Function names.

But after reading on how themes works on VSCode I discovered how to find the proper ids.

There is a very handy tool that you can use to inspect.

Now I have the correct color for '@exports'

I may come back to this later redo my theme changes, using the proper textmate scope keys

Debugging in VSCode

Using VSCode debug iis well.... Better.

You can use the debug console to print and change variables.

We got our call stack, and all our debugger features.

But there are also some cons.

I think this is a bug, but sometimes vscode debugger would get a variable with only an objectID.
So you can't see the variables inside them.

It worked fine when the breakpoint happend but then I after pressing F5 to continue. And the next time it stopped, the 'root' variable was an ObjectID. The variable would also change to its objectID type if I tried to print it into the debug console.

If you used the debugger inside Godot, clicking on the objectID would select that inside the Inspector, where you could see all its members variables.

But the way the godot-tools work, the Godot Editor and VSCode debugger are not linked.

You are either running the game within Godot, or ar running a stand-alone version launched from VSCode.

So when starting the debugger from VSCode, you lose the ability to see the remote-scene and change them in runtime within the editor.

Maybe this will change in the future.

---

But that's it.

I think using VSCode for gdscript is a viable alternative for bigger projects.

I'll keep experimenting with it and using it every now and again on some prototype game projects.

---

As a bonus, Codeium is still a free co-pilot like tool that works with gdscript.

So if you like that, you can try it.

I'm personally not using it, but I might try it in the future out of curiosity.

---

Update - Down the rabbit hole

I got too much into it, and ended up learning how syntax highlight works in vscode.

I've made a few grammar injections to fix most of the missing colors. Here's the result:

Now can you spot the differences?

Experimenting with gdscript in VSCode (update)

More Creators