Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for external editors with Mono/C#/.NET and/or document how to enable them #2

Open
Zishan-Rahman opened this issue Dec 19, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@Zishan-Rahman
Copy link
Collaborator

Essentially the same as flathub/org.godotengine.GodotSharp#2, but for this Godot 3 C# Flatpak instead of the Godot 4 C# Flatpak.

The suggestions from the Godot 4 C# Flatpak's relevant issue made here and here could be relevant to this Flatpak too.

@Zishan-Rahman Zishan-Rahman added the enhancement New feature or request label Dec 19, 2023
Zishan-Rahman added a commit that referenced this issue Dec 19, 2023
Update appdata.xml patch with updated information on MSBuild, external C# script editors and this Flatpak being unofficial

- Mark this Flatpak as unofficial
- Describe usage of .NET 8 for MSBuild
- Describe usage of external editors for C# scripting and link to flathub/org.godotengine.GodotSharp#2 and #2
@geekley
Copy link

geekley commented Dec 20, 2023

See flathub/org.godotengine.GodotSharp#2 (comment)

The corresponding scripts for Godot3Sharp are slightly different. That's because there's no editor setting for custom exec and args in Godot 3. So the user is instead instructed to create a wrapper script in the PATH if they need the program to run in some custom way (e.g. Flatpak VSCode, etc).

/app/bin/code

#!/usr/bin/sh
flatpak-spawn --host code "$@" && exit
zenity --name='godot_editor' --class='godot' --error --title='Godot: Mono External Editor' \
	--window-icon="/app/share/icons/hicolor/scalable/apps/org.godotengine.Godot3Sharp.svg" \
	--no-wrap --text="\
Trying to run external editor <b>VS Code</b> failed: EXIT_STATUS=$?.
Ensure the <b>code</b> program is available outside Flatpak via command line.

Or provide a custom script for it in <b>~/.local/bin/code</b>, e.g.:
<i>#!/usr/bin/sh
flatpak run com.visualstudio.code \"\$@\"</i>

You can also disable this editor setting to use the internal script editor:
<b>mono/editor/external_editor</b>"

/app/bin/monodevelop

#!/usr/bin/sh
flatpak-spawn --host monodevelop "$@" && exit
zenity --name='godot_editor' --class='godot' --error --title='Godot: Mono External Editor' \
	--window-icon="/app/share/icons/hicolor/scalable/apps/org.godotengine.Godot3Sharp.svg" \
	--no-wrap --text="\
Trying to run external editor <b>MonoDevelop</b> failed: EXIT_STATUS=$?.
Ensure the <b>monodevelop</b> program is available outside Flatpak via command line.

Or provide a custom script for it in <b>~/.local/bin/monodevelop</b>, e.g.:
<i>#!/usr/bin/sh
/path/to/monodevelop \"\$@\"</i>

You can also disable this editor setting to use the internal script editor:
<b>mono/editor/external_editor</b>"

@Zishan-Rahman
Copy link
Collaborator Author

See flathub/org.godotengine.GodotSharp#2 (comment).

Given the lack of specific editor settings for Mono/C# in Godot 3, I'm more willing to entertain the idea of custom wrapper scripts here. There has to be other ways to solve this issue, though.

@geekley
Copy link

geekley commented Dec 21, 2023

Well, if it serves as a motivation, Unity Hub's flatpak uses a wrapper script for code too (that's where I got the idea from).

But theirs needs to be much more complex because it also handles this:

In order for debugging to work, the Unity Debugger VS Code extension needs to be able to find Unity Editor's PID.

Mine is much simpler because tbh I didn't even try to use VSCode debugging with Godot (I don't even know if I can, or if Flatpak causes any issues). I know VSCode's GDScript connects to Godot-flatpak's port just fine, so I just assumed C# debugging wouldn't be an issue I guess. But it's worth testing that, in and out of Flatpak.

There has to be other ways to solve this issue, though.

IMO the most ideal way would be for it to be solved upstream, where Godot's code would detect if it's inside a flatpak by the presence of /usr/bin/flatpak-spawn and do any necessary workarounds directly in the editor's code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants