Godot version
4.4.1
VS Code version
1.103.2
Godot Tools VS Code extension version
2.5.1
System information
MacOS Ventura
Issue description
The "first" godot.project file that gets picked by the extension is not always intuitive.
In godot_utils the get_project_dir function picks the "top-most" godot.project file based on the shortest fsPath length. This generally works, but has 2 issues:
Multi-root workspaces
In multi-root workspaces, the shortest path may not be the first project folder. In such cases, there's no way to organize the workspace to control the project that gets picked. e.g. the following code-workspace file will always pick the /another/godot/project project since it has a shorter fs path length.
Single-root workspaces
In single-root workspaces, the shortest path length may not always be the first one in the fs order if there are multiple projects at same folder level but 2nd folder has a shorter name. e.g. the 2nd project will be selected in this case:
game
/folder-with-long-name
godot.project
/short-name
godot.project
Steps to reproduce
Setup a multi-root workspace where the folder paths have different lengths and each contains a godot.project file. The one with the shortest fs path length will always be used.
In a single root workspace, create 2 subfolders with different name lengths each containing a godot.project file. Don't include a godot.project file in the root. Whichever folder has the shortest fs path name will win regardless of fs sort order
Godot version
4.4.1
VS Code version
1.103.2
Godot Tools VS Code extension version
2.5.1
System information
MacOS Ventura
Issue description
The "first" godot.project file that gets picked by the extension is not always intuitive.
In
godot_utilstheget_project_dirfunction picks the "top-most"godot.projectfile based on the shortest fsPath length. This generally works, but has 2 issues:Multi-root workspaces
In multi-root workspaces, the shortest path may not be the first project folder. In such cases, there's no way to organize the workspace to control the project that gets picked. e.g. the following
code-workspacefile will always pick the/another/godot/projectproject since it has a shorter fs path length.{ "folders": [ { "path": "/some/path/to/a/godot/project" }, { // This project will always get picked "path": "/another/godot/project" } ] }Single-root workspaces
In single-root workspaces, the shortest path length may not always be the first one in the fs order if there are multiple projects at same folder level but 2nd folder has a shorter name. e.g. the 2nd project will be selected in this case:
Steps to reproduce
Setup a multi-root workspace where the folder paths have different lengths and each contains a godot.project file. The one with the shortest fs path length will always be used.
In a single root workspace, create 2 subfolders with different name lengths each containing a godot.project file. Don't include a godot.project file in the root. Whichever folder has the shortest fs path name will win regardless of fs sort order