This is not a question, this is meant to help others if they Google the problem.
=========================
I absolutely hate Godot, and I hate GDScript even more. Everything about both of them. That’s right, deal with it. But I’m stuck with it. So the least I can do is trying to help others. <3 <3
Here is a list of classic blunders (and how to fix them) when you try to make Godot and VSCode work together.
All the tips below are for Windows.
1) Pre-requisite : Every time I say “godot-tools settings” I mean this : In VSCode, go to the “Extensions” panel, locate the “godot-tools” extension, click the little cogwheel, “extension settings”.
Then the 3 settings you’ll use the most are :
- Editor_path
- Gdscript_lsp_server_host
- Gdscript_lsp_server_port
Please note : those settings exist under both “user” and “workspace” (tabs at the top of the settings panel). I seem to remember that “user” supercedes “workspace”, but just keep in mind that you don’t need to populate the value in both. Pick one and stick to it.
2) Check that you have the correct version of Godot running
If you’ve migrated to, let’s say, Godot 4.2, maybe you were running Godot 4.1 at the time you ran VSCode. Now VSCode tries to connect to a different instance or something. Check the path to Godot in the godot-tools settings. Close Godot and re-open the right one.
3) Check that you don’t have old godot settings stored in your project folder
- Go to your Godot project folder
- Delete hidden folder .godot
- Close Godot and re-open your project
4) Wrong port
Godot chaged from 6008 to 6005 at some point.
In Godot : Editor Settings → Network → Language server → Remote port → 6005
In VSCode : godot-tools settings → Gdscript_lsp_server_port → 6005
5) Triple check that VSCode is properly configured in Godot
In Godot : Editor Settings → Text Editor → External
Exec Path :
- Replace backslashes with forward slashes (because why not)
- DO NOT surround with double quotes, even if your path contains white spaces
- It must be the full path the the .exe file (included)
Exec flags : Make sure it’s verbatim what you’ve been told
{project} --goto {file}:{line}:{col}
6) Only one instance of VSCode open!
I had the following symptoms : In Godot, I double-click a GDScript file. It opens VSCode (as expected) but does not open the project folder and does not open the file.
Solution : This happens if there is any other instance of VSCode already running (even if they have a different folder/project open in them).
Close every VSCode window then try again; this time your gdscript file opens properly as well as the project that contains it.
If that still doesn’t work, maybe check if you have a zombie code.exe still running (by using the Task Manager)
You might also encounter issues when VSCode was open on a different project/folder the LAST TIME it ran. Switch to your Godot project before closing VSCode and retry opening a .gd file.
7) When debugging: Missing “http” in the url in launch.json
In VSCode, you need to create a launch.json file when you try to run your project in Debug mode drectly from VSCode (look for tutorials on how to do that).
- Open the launch.json file
- “address”: replace “127.0.0.1” with “http://127.0.0.1”.
Oh and while you’re at it check that the port has the correct value.
You will find the correct value in Godot → Editor settings → Network → debug → Remote port. It’s most likely 6007
8) Check the DEBUG ports
In Godot : Editor Settings → network–> Debug Adapter
Remote port : 6008
Sync breakpoints : TICKED
In VSCode : Open launch.json as explained before and add “debugServer” entry
"port": 6007,
"debugServer": 6008,
"address": "http://127.0.0.1",