godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.53k stars 151 forks source link

Couldn't connect to the GDScript language server #446

Closed leftbones closed 1 year ago

leftbones commented 1 year ago

Godot version

4.0.beta11.mono.official [91713ced8]

VS Code version

1.74.3

Godot Tools VS Code extension version

1.3.1

System information

Windows 11

Issue description

I'm having the classic Couldn't connect to the GDScript language server at 127.0.0.1:6008. Is the Godot editor running? error message. I found a few other issues posted where people resolved the issue by having the Godot editor running or by launching Godot before launching VSCode, but I've done both of those things and it still won't connect no matter how many times I retry.

I'm on the 4.0 beta .NET version now, but I should mention I also had this same issue months ago with 3.5 GDScript and just gave up trying to get it to work and ended up just working without it.

I also have the "C# Tools for Godot" extension installed, which I believe automatically installs this one.

Steps to reproduce

  1. Open project in Godot
  2. Open a script to edit (launches VSCode)
  3. Extension fails to connect, retrying also fails to connect
jomiq commented 1 year ago

In Godot, under Editor > Editor Settings > Network > Language Server, check the Remote Host and Remote Port. Mine was set to 127.0.0.1:6005. I added this to my .vscode/settings.json: "godot_tools.gdscript_lsp_server_port": 6005, but you can try changing the port in Godot as well.

atirut-w commented 1 year ago

I don't think this is really a bug since Godot 4 is not officially supported by this extension yet AFAIK. Would like to see Godot 4 support really soon though.

ybai55 commented 1 year ago

In Godot, under Editor > Editor Settings > Metwork > Language Server, check the Remote Host and Remote Port. Mine was set to 127.0.0.1:6005. I added this to my .vscode/settings.json: "godot_tools.gdscript_lsp_server_port": 6005, but you can try changing the port in Godot as well.

This works fine with Godot Beta 10. But the Debugger is not working yet. Looking forward to see the debugger works.

ybai55 commented 1 year ago

Thanks, this works for me.

On Tue, Jan 17, 2023 at 6:24 PM git_vb @.***> wrote:

I found similar problem . I use

  • Debian 11
  • vscode 1.74.3
  • v4.0.beta12.official [3c9bf4bc2]

I was able to run in debug mode with this 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": "debug://127.0.0.1", "launch_game_instance": true, "launch_scene": false } ] }```

But I'm still working in breakpoints... :)

— Reply to this email directly, view it on GitHub https://github.com/godotengine/godot-vscode-plugin/issues/446#issuecomment-1385166314, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASZD7ZI4YRGTHUZ33D55BLDWSZXMFANCNFSM6AAAAAAT2WJAY4 . You are receiving this because you commented.Message ID: @.***>

kolulu23 commented 1 year ago

In Godot, under Editor > Editor Settings > Network > Language Server, check the Remote Host and Remote Port. Mine was set to 127.0.0.1:6005. I added this to my .vscode/settings.json: "godot_tools.gdscript_lsp_server_port": 6005, but you can try changing the port in Godot as well.

Works on godot4_rc1 without mono support as well, although it seems that the port change does have something to do with godot4: [4.x] Auto-Increment Debugger Port (And a bit of cleanup) .

Anyway, right now this change is not documented on godot docs migrating page.

leftbones commented 1 year ago

In Godot, under Editor > Editor Settings > Network > Language Server, check the Remote Host and Remote Port. Mine was set to 127.0.0.1:6005. I added this to my .vscode/settings.json: "godot_tools.gdscript_lsp_server_port": 6005, but you can try changing the port in Godot as well.

Coming back to this late, but yes, this is the solution. No idea why the port was set to 6008 by default on mine, but I didn't think to check for whatever reason. Thanks!

DaelonSuzuka commented 1 year ago

It's because the Godot editor's default LSP port actually changed from 3 to 4. I do intend to make this extension check both ports by default, but I haven't had time to implement that yet.

What I did was change the LSP port in Godot 4 editor to 6008, so both 3 and 4 use the same port,

visuallization commented 1 year ago

In Godot, under Editor > Editor Settings > Network > Language Server, check the Remote Host and Remote Port. Mine was set to 127.0.0.1:6005. I added this to my .vscode/settings.json: "godot_tools.gdscript_lsp_server_port": 6005, but you can try changing the port in Godot as well.

Thanks so much for this, I was googling where the godot ls port is and couldn't find it. Finding your answer in the github issue search saved me from more frustration. :D