godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.48k stars 148 forks source link

Extension fails to parse version of linux Godot build #548

Closed meelkor closed 6 months ago

meelkor commented 7 months ago

Godot version

4.2.stable.arch_linux

VS Code version

1.84.2

Godot Tools VS Code extension version

master

System information

Arch Linux

Issue description

Not sure whether this is general 4.2 problem or it's OS-specific but: The default version of godot in Arch Linux repository has the following version string: 4.2.stable.arch_linux which currently isn't correctly parsed by the extension since the regexp expects the 9 character build hash(?) which is missing. Resulting in:

Cannot launch debug session: 'editorPath.godot4' of '/bin/godot' is not a valid Godot executable

Changing the expression to /([34])\.([0-9]+)\./ solves the issue. Is there any point in having the regexp that strict when realistically the extension is only using the major version number?

Steps to reproduce

not applicable

DaelonSuzuka commented 7 months ago

Is there any point in having the regexp that strict when realistically the extension is only using the major version number?

The point was to prevent false positives from other applications that respond to --version.

meelkor commented 7 months ago

Aah, that makes sense. The version string my executable reports is very general indeed. Maybe the first words of godot -h (Godot Engine) could be used instead to validate that?

DaelonSuzuka commented 7 months ago

Yeah, this is the second problem there's been with version strings I didn't expect. I'll definitely have to redo the version checking. It's also duplicated in like 4 places, so it needs to be cleaned up anyways.

DaelonSuzuka commented 7 months ago

Maybe the first words of godot -h (Godot Engine) could be used instead to validate that?

Thanks for the suggestion, I ended up going with this, and the regex:

/^Godot Engine v(([34])\.([0-9]+)(?:\.[0-9]+)?)/

This is being fixed in #553.

Is there any point in having the regexp that strict when realistically the extension is only using the major version number?

I forgot to mention that it's also using the minor version to check if the Godot binary supports LSP headless mode.