godotengine / godot-vscode-plugin

Godot development tools for VSCode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Headless LSP can't use relative path

RedMser opened this issue · comments

Godot version

4.3.dev (6118592c6d)

VS Code version

1.88.1

Godot Tools VS Code extension version

2.0.0

System information

Windows 10

Issue description

I'm working with custom engine builds, and I'd like to have a consistent vscode setup that can be pushed to git.

Trying to specify the godotTools.editorPath.godot4 to a relative path of any kind seems to not work, with the error

Cannot launch headless LSP: <path> is not a valid Godot executable

Steps to reproduce

  • Create a .vscode/settings.json in your workspace.
  • Create a build folder and put a godot executable into it.
  • Fill with { "godotTools.editorPath.godot4": "build/godot.windows.editor.x86_64.console.exe" }
  • Try running command godotTools.startLanguageServer.
  • Even with variations of the path like "${workspaceFolder}/build/godot.windows.editor.x86_64.console.exe" or "./build/godot.windows.editor.x86_64.console.exe" it does not manage to launch it.
  • I also confirmed that it works fine with an absolute path (although the executable did open a new cmd window, likely because of using the console.exe?).

Add the Godot binary to your system path? I put all my Godot exes in a standard location and add that to my path, so then I can just use godot3 or godot4 or whatever.

I think the relative path issue is something to do with node child process handling and inheriting env stuff correctly. I'll try to look into that.

Yes I could do that, but the use case is when others clone my project (which depends on a specific custom engine build). It would be convenient to include the engine directly in the workspace and not in a global location then.

Thanks for looking into it! Another thing you could try is calling path.resolve(workspaceFolder, editorPathConfigValue) if the config contains a relative path.

Yeah, that makes sense. Let me see what I can do.

@RedMser Do you mind downloading and installing the build artifact and confirming that it does what you expect now?

@DaelonSuzuka Yep it works as expected with a relative path in my workspace's settings.json! Thanks a lot :)

(Disclaimer: I have not tested full absolute paths, or paths like godot4.exe)

I'm still getting the same error as described in this issue. Should I create a new issue or would you like to continue on this one?

This issue has been resolved in master, so there's no reason to open a new one.

Ah thanks. I somehow thought it was already in the release. Any eta on when it will be released?

I'm working on cleaning up some loose ends right now, so hopefully soon.