godot-vscode-plugin icon indicating copy to clipboard operation
godot-vscode-plugin copied to clipboard

Allow to set godotTools.editorPath.godot4 value to environment variable

Open cortrano opened this issue 10 months ago • 1 comments

Godot version

4.3 stable

VS Code version

1.97.2

Godot Tools VS Code extension version

2.4.0

System information

Windows 11

Problem statement

Now i can't set godot path using environment variable working:

settings.json
{
    "godotTools.editorPath.godot4": "c:\\Software\\Godot_v4.3-stable_mono_win64\\Godot_v4.3-stable_mono_win64.exe"
}

not working: settings.json

{
    "godotTools.editorPath.godot4": "${env:GODOT_PATH}"
}

Proposed solution

Add environment variable parsing

cortrano avatar Feb 27 '25 10:02 cortrano

Why?

DaelonSuzuka avatar Feb 27 '25 13:02 DaelonSuzuka

Because it increases ease-of-use. Additionally there are relatively popular tools to install multiple self-contained versions of Godot side-by-side. When there are multiple versions of Godot available, the "active" or "default" version is typically updated by setting a single environment variable to the path of the desired Godot editor binary. So if someone who has multiple Godot versions installed decides to change versions for whatever reason, they will have to reconfigure the extension to utilize the correct Godot editor (unless env vars are supported).

OmnesPotens avatar Apr 09 '25 00:04 OmnesPotens

Why?

The issue with manually specifying the path to the Godot executable in settings.json is twofold. First, it’s inconvenient because it requires users to locate and input the path themselves, which can be error-prone, especially for those unfamiliar with file system navigation or non-standard installations. Second, and more critically, when working in a team, committing settings.json to version control creates conflicts. Each team member likely has the Godot executable installed in a different location (e.g., C:\Program Files\Godot on one machine vs. /home/user/godot on another). This results in constant path mismatches, forcing manual updates or exclusions of settings.json from commits, both of which disrupt workflows. A dynamic or auto-detected path would resolve these issues by eliminating the need for hardcoded values.

cortrano avatar Apr 15 '25 16:04 cortrano

Added a PR to address this: https://github.com/godotengine/godot-vscode-plugin/pull/856

PawnTheAmazing avatar May 07 '25 22:05 PawnTheAmazing

Why?

It should be self-evident really. There are already 2 clear answers to "why?" but it baffles me that this is not recognised as a "must have" immediately. When working in teams or on different systems, relying on environment variables to resolve paths is, I'd say, mandatory!

It would be nice if the PR from @PawnTheAmazing was approved asp.

daniele-niero avatar May 09 '25 12:05 daniele-niero

I work with teams and on different systems and have never remotely needed this. Calling it "mandatory" honestly makes it sound like you don't know how to use a computer.

As for the PR: I will review it when I have time, and no amount of attitude will make that happen any faster.

DaelonSuzuka avatar May 09 '25 13:05 DaelonSuzuka

did I touched a nerve?

So if you work in Windows and in Linux and want your code-workspace or settings.json to stay untouched you do what exactly?

To be honest, attitude or not, failing to understand the utility of something so basic as environment variables is what really "makes it sound like you don't know how to use a computer."

Approving this PR takes 5 minutes.

daniele-niero avatar May 09 '25 13:05 daniele-niero

Y'all, can we chill? This issue has been known since Feb and no one had put in a fix. A few more days to get it in won't hurt anyone.

PawnTheAmazing avatar May 09 '25 14:05 PawnTheAmazing

Rename the godot binary, add godot binary folder to system path. This is trivial.

Approving this PR takes 5 minutes.

>assuming

DaelonSuzuka avatar May 09 '25 14:05 DaelonSuzuka

This would solve also the issue with using multiple OS's. https://github.com/godotengine/godot-vscode-plugin/issues/778 Team can have different devices they use for Godot and they will have executable in different places, possibly in name specific user-folder, which definitely won't be same for each one. There is no real instructions to where to keep the Godot executable, heck you can just run it from your Desktop-folder. There is no installer that would save it in specific place. for example you could have:

  • windows: "c:\Users\username_foo\Desktop\Godot.exe"
  • linux: "/home/username_bar/Desktop/Godot.x86_64"
  • mac: "/Applications/Godot.app"

This kind of setting should be locally settable for each local environment, whatever the way is to do that.

No need to argue here. I know you can find a way make it happen somehow or ask help for it.

EDIT: I think this is also related issue: https://github.com/godotengine/godot-vscode-plugin/issues/502

Crare avatar May 18 '25 09:05 Crare

Rename the godot binary, add godot binary folder to system path. This is trivial.

Great, now consider that some of us are working on different projects with different versions of Godot. Now the system Path (environment variable, by the way) is not sufficient anymore. Now you would need to prepare the environment before launching VSCode and dynamically append the path to the Godot you want to use.

You can find all sort of workarounds, but none of them would be as easy and clean as to allow environment variables in VSCode's settings.

daniele-niero avatar May 19 '25 07:05 daniele-niero

Personally, I have godot in PATH, but on Windows it'll be a stable version installed from Scoop, while on Linux it'll be the master branch I compiled from source.

I think we'll want to standardize the concept of a GODOT_PATH environment variable for third-party tools to use (including this extension) in the long run, similar to GOPATH in Go. Therefore, I support this proposal, but it might be worth discussing more in detail on https://github.com/godotengine/godot-proposals.

Calinou avatar May 19 '25 14:05 Calinou

  • Implemented by https://github.com/godotengine/godot-vscode-plugin/pull/856.

Calinou avatar Jul 28 '25 21:07 Calinou