Windows external editor VSCode double-click integration works with GDScript but not C#/CSharp.

Godot Version

4.6.1

Question

I am using VSCode as my external editor for Godot. I followed the instructions to setup Godot for using an external code editor multiple times exactly.

What is not working:

  • edit C# externally with Double-Click from the ‘File System’ tab.

What is working:

  • edit GD scripts externally with Double-Click from the ‘File System’ tab and using the context menu entry ‘Open in External Program’.
  • edit C# code using the context menu entry ‘Open in External Program’

The console gives me this exception:

ERROR: Cannot find code editor: Visual Studio Code or VSCodium
   at: Godot.Error GodotTools.GodotSharpEditor.OpenInExternalEditor(Godot.Script, int, int) (/root/godot/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs:397)
   C# backtrace (most recent call first):
       [0] void Godot.GD.PushError(string) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs:366)
       [1] Godot.Error GodotTools.GodotSharpEditor.OpenInExternalEditor(Godot.Script, int, int) (/root/godot/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs:397)
       [2] bool GodotTools.GodotSharpEditor.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) (/root/godot/modules/mono/editor/GodotTools/GodotTools/Godot.SourceGenerators/Godot.SourceGenerators.ScriptMethodsGenerator/GodotTools.GodotSharpEditor_ScriptMethods.generated.cs:156)
       [3] Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(nint, Godot.NativeInterop.godot_string_name*, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error*, Godot.NativeInterop.godot_variant*) (/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:24)

If you followed the instructions exactly and it still fails with an error, you might need to raise a bug report.

Windows or Linux?

Windows shouldnt be an issue, Linux is a bit of a pain in my experience.

I thought it might be a bug. But since I didn’t find any evidence online, I thought it was me.

It is Windows.

It does seem to be a bug as the behavior is inconsistent with the documentation.

To open C# files with double-click seems to only work in the latest code base when the vscode executable is present int the PATH (Windows) environment variable. Which is also the workaround.

See: Windows external editor VSCode double-click integration does not work with C#/CSharp. · Issue #117513 · godotengine/godot · GitHub for further details.

1 Like