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

Opening scripts from Godot doesn't open them in the VS Code workspace window when using a VS Code workspace

Open mickdekkers opened this issue 5 years ago • 1 comments

I created a VS Code workspace for my project so I can store project-specific VS Code settings and extension recommendations alongside the project files and enable/disable certain extensions for the workspace.

I encountered this issue when I attempted to open a script from Godot.

Steps to reproduce

  1. Create a new project in Godot
  2. Open the project folder in VS Code (either manually or through Godot)
  3. File -> Save Workspace As... -> (<anything>.code-workspace) -> Save

The project folder is now open as part of the workspace we just saved.

  1. Create a new node and attach a script to it in Godot
  2. Observe as a new VS Code window is opened for the project folder with the script open instead of the existing window being used

The same issue occurs when opening an existing script from Godot. Also, if you close the new VS Code window and try to open the script from Godot again, it will reopen the window. Opening scripts from Godot never opens them in the workspace window, even if the script is already open in that window.

Editing scripts from the workspace window works fine as far as I can tell, they are just not opened there from Godot.

Restarting VS Code or Godot does not affect the issue.

Additional info

Versions

Windows 10 Godot version 3.2.3.stable.official VS Code version 1.49.1 godot-tools version 1.1.2

Settings

"godot_tools.editor_path": "C:/software/Godot_v3.2.3-stable_win64.exe"

I set Godot's external editor Exec Path and Exec Flags settings according to the README.

mickdekkers avatar Sep 20 '20 15:09 mickdekkers

Removing {project} from the Exec Flags option fixes the issue for me. I dont think the issue is from the extension or Godot itself, I think it's related to how VS Code handles multiple instances.

What you can do is modify the Exec Flags option like so {project}/<anything>.code-workspace --goto {file}:{line}:{col}. For me it works as intended and only use the window which has that workspace open.

linkpy avatar Oct 27 '20 15:10 linkpy