Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default LSP server port of plugin doesn't match with default port of Godot 4 #473

Closed
tymbaca opened this issue May 2, 2023 · 14 comments
Closed

Comments

@tymbaca
Copy link

tymbaca commented May 2, 2023

Godot version

4.0.2.stable.official

VS Code version

1.77.3 (Universal)

Godot Tools VS Code extension version

1.3.1

System information

MacOS Monterey (12.6.3)

Issue description

By default Godot 4 Language Server port is set to "6005", whereas Godot Tools default is set to "6008".

So can't connect to Godot 4's Language Server via VS Code without changing either Godot Tools settings or Godot Language Server settings.

Steps to reproduce

  • Install Godot Tools VS Code extension
  • Install Godot 4 (make sure "Network/Language Server" settings are set to default
  • Try to connect to LSP via VS Code
@Calinou
Copy link
Member

Calinou commented May 2, 2023

For reference, this is why the default port was changed:

The LSP port changed in Godot 4, as the one used in Godot 3 conflicted with the normal debugger port when using multiple Godot instances.

godotengine/godot#75683

@idbrii
Copy link

idbrii commented Jun 7, 2023

FYI, these lines in godot-vscode-plugin need to be changed (godotTools.lsp.serverPort): https://github.com/godotengine/godot-vscode-plugin/blob/master/package.json#L182-L186. Found while I was fixing vim-lsp-settings, but I don't use vscode so I'm not making a PR.

Godot 3 users of this plugin can change to use port 6005 in editor -> editor settings -> network -> language server -> remote port.

Here's the port number in Godot4's code:
https://github.com/godotengine/godot/blob/master/modules/gdscript/language_server/gdscript_language_server.h#L47-L48

@lostfictions
Copy link
Contributor

lostfictions commented Jun 16, 2023

Hi there, can this issue be pinned in the interim? The impression this gives to users at the moment is that this extension simply doesn't work. Unless I missed something, there's nothing in the README about this and it will simply fail for all users of Godot 4.

@jst4rk
Copy link

jst4rk commented Aug 21, 2023

I have the same port configured in both and does not work at all, I even change the porotol to ws but nothing happens
I'm using the latest version of VSCode and Godot 4.1

@CuitGGyy
Copy link

CuitGGyy commented Aug 23, 2023

I have the same situation on my macos ventura. Godot 4.1.1 and godot-tools 1.3.1, I have configured port 6005 and vscode connected godot, but when launch debug in vscode,godot-tools always report error "Failed to launch Godot instance: Error: Command failed: ... "

@Calinou Calinou pinned this issue Aug 23, 2023
@midblue
Copy link

midblue commented Aug 27, 2023

Can confirm that the address is set to 127.0.0.1:6005 in both Godot and VS Code and VS Code hangs forever on "Initializing" with the message "Connecting to the GDScript language server at 127.0.0.1:6005". (Godot 4.1, OSX). The project is open in Godot.

@Corvinoo
Copy link

Can confirm that the address is set to 127.0.0.1:6005 in both Godot and VS Code and VS Code hangs forever on "Initializing" with the message "Connecting to the GDScript language server at 127.0.0.1:6005". (Godot 4.1, OSX). The project is open in Godot.

For me opening the project's folder in VSCode solves it

@torves
Copy link

torves commented Sep 23, 2023

Godot requires the address to be of the format <protocol>://<host/ip>:<port>.
The default config does not include the <protocol> (http) in the launch.json and must be added manually.
Temporary fix is to edit your launch.json file and change the "address": "127.0.0.1" to "address": "http://127.0.0.1".

Also ensure you have set the "godot_tools.editor_path" property in your settings.json if it is not in your environment variables path.

@DaelonSuzuka
Copy link
Collaborator

The next extension release, 1.4.0, will solve this in multiple ways.

When using Godot 3.6 or 4.2, a new headless LSP mode will be available that spawns a new language server specifically for each workspace. (#488)

#511 adds a port fallback mechanism to automatically find the right port, which makes everything Just Work when using default settings.

@DaelonSuzuka DaelonSuzuka unpinned this issue Oct 13, 2023
@chrisl8
Copy link

chrisl8 commented Oct 13, 2023

Can we test this? I pulled down the master branch and built the extension, and it claims to try to start a headless background LSP instance when set up to do so, but it never works. It just fails every time. Are there logs that I can look into to see if why it fails to start?

I will post some screenshots this evening.

@DaelonSuzuka
Copy link
Collaborator

It just fails every time.

Headless LSP mode checks to make sure it can run and displays errors if it detects that something is wrong, it shouldn't "just fail".

@chrisl8
Copy link

chrisl8 commented Oct 13, 2023

It just fails every time.

Headless LSP mode checks to make sure it can run and displays errors if it detects that something is wrong, it shouldn't "just fail".

I'm guessing I've messed up my configuration in some way that is thwarting it. I would like to help sort out what I did wrong before 100,000 users hit it and repeat my mistakes.
I'm away from my system today, but I'll work through it again tonight or tomorrow and post screenshots.

@DaelonSuzuka
Copy link
Collaborator

I would like to help sort out what I did wrong before 100,000 users hit it and repeat my mistakes.
I'm away from my system today, but I'll work through it again tonight or tomorrow and post screenshots.

That would be great. Please open a new issue for this whenever you get back, and I'll make sure it gets sorted out.

@DaelonSuzuka
Copy link
Collaborator

Extension version 2.0.0 has been published, which automatically finds the correct LSP port in most cases.

If you're still experiencing issues connecting to the LSP, please revert all the LSP port settings to their default values (both in VSCode and in the Godot Editor settings) and try again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests