Editor tries to open files from totally unrelated project
Tested versions
- Reproducible in v4.3.dev6.mono.official [89850d553]
System information
Godot v4.3.dev6.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 6GB (NVIDIA; 31.0.15.5212) - Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz (4 Threads)
Issue description
When opening a project, I get Attempt to open script errors where Godot tries to open files from other project. The project I opened in Godot is not the c:/godot/mechtech project that is shown in the error messages.
Godot Engine v4.3.dev6.mono.official (c) 2007-present Juan Linietsky, Ariel Manzur & Godot Contributors.
--- Debug adapter server started ---
--- GDScript language server started on port 6005 ---
[LSP] Connection Taken
Attempt to open script 'file://c:/godot/mechtech/mechs/mech_builder.gd' resulted in error 'Can't open file'.
Attempt to open script 'file://c:/godot/mechtech/mechs/mech_builder.gd' resulted in error 'Can't open file'.
...
Steps to reproduce
- Open project A in vscode
- Open some gdscript files of project A in vscode
- Make sure that vscode tries to connect to Language Server (LSP)
- Open project B in Godot -> Godot tries to open files belonging to project A
To reproduce the situation again, just restart vscode.
Minimal reproduction project (MRP)
N/A
Reproduced in 4.3 stable.
I use vscodium to edit a GDScript file whose path appeared in Godot editor error logs.
I also suspect that the LSP server or the LSP client is not handling file path correctly. I usually see 3 slashes in file: URI. The same file would be represented as file:///home/neruthes/....
The main problem with this issue, is that while we could fix the way URIs are converted to file paths, this is still a use case that we can't support. The whole state of global classes etc. is managed through singletons. We can't support multiple projects from the same Godot instance so even if the paths were converted correctly it would lead to other confusing issues down the line. As a middle ground we could fix the path conversion and send a meaningful error/warning to the client.