godot icon indicating copy to clipboard operation
godot copied to clipboard

Editor tries to open files from totally unrelated project

Open miv391 opened this issue 1 year ago • 1 comments

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.

kuva

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

  1. Open project A in vscode
  2. Open some gdscript files of project A in vscode
  3. Make sure that vscode tries to connect to Language Server (LSP)
  4. 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

miv391 avatar May 22 '24 10:05 miv391

Reproduced in 4.3 stable.

image

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/....

neruthes avatar Aug 18 '24 00:08 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.

HolonProduction avatar Mar 11 '25 13:03 HolonProduction