Allow to set godotTools.editorPath.godot4 value to environment variable
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
Why?
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).
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.
Added a PR to address this: https://github.com/godotengine/godot-vscode-plugin/pull/856
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.
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.
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.
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.
Rename the godot binary, add godot binary folder to system path. This is trivial.
Approving this PR takes 5 minutes.
>assuming
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
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.
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.
- Implemented by https://github.com/godotengine/godot-vscode-plugin/pull/856.