This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi,
I'm trying to hook up vs code to godot, so far I've got the LSP connecting fine, but when I open a script and hit debug/F5 instead of launching into the project's gameplay, it opens up the project selection GUI.

Help please :)

Godot version 3.5
in Engine by (33 points)

1 Answer

+2 votes
Best answer

There are a few steps you have to follow to ensure VS Code works correctly with Godot. If you haven't already, make sure you follow the steps here carefully:
https://docs.godotengine.org/en/stable/tutorials/editor/external_editor.html#official-editor-plugins

At the bottom of that page is a link to the official godot extension for VS Code, which can be found here:
https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools

Install that extension and follow the steps in its overview page under "Settings".

You should be able to get VS Code working by following these steps.

However, from all these steps, there are two instructions talking about linking to executables using absolute paths which may be tripping you up:

First, when setting up the godot editor to use an external text editor, there's a note that you must choose the file, code.cmd, as your editor's executable. For me on Windows, this was in my C:\Users\<username>\AppData\Local\Programs\Microsoft VS Code\bin folder.

Second, once the Godot Tools VS Code extension is installed, you must point the Godot Tools extension to your godot executable. Open VS Code's settings (default shortcut Ctrl+,) and search for editor_path. There should be an entry under the Godot_tools extension, like so:
Godot_tools setting Editor_path in VS Code

Set this to the absolute path to your godot executable, and you should be good to go.

I followed these steps successfully using godot v3.4.4. Hopefully there isn't a major difference between versions causing your issue.

by (95 points)
selected by

That cleared up a few things! The last thing I had to do was put "${workspaceFolder}" in quotes. Thanks again!
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "GDScript Godot",
"type": "godot",
"request": "launch",
"project": "${workspaceFolder}",
"port": 6007,
"address": "127.0.0.1",
"launchgameinstance": true,
"launch_scene": true
}
]
}

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.