godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.88k stars 21.03k forks source link

editor plugin language category rolls back to GDScript for C# plugin after reopening IDE #68906

Open nofacer opened 1 year ago

nofacer commented 1 year ago

Godot version

4.0.beta5.mono

System information

MacOS 13.0.1 (22A400)

Issue description

A plugin was created with C# Language. But in plugin edit page, the Language field shows GDScript. After changing to C# and reload the project it became GDScript again.

Steps to reproduce

  1. Create a C# plugin
  2. Close IDE and reopen it.
  3. Go to Project setting -> Plugin and edit plugin
  4. The language is GDscript instead of C#
  5. Change language to C# and save
  6. Close IDE and reopen it
  7. Go to Project setting -> Plugin and edit plugin
  8. The language changes back to GDscript again

Here is a screen recording. Please wait for seconds to load:

Kapture 2022-11-20 at 08 56 04

Minimal reproduction project

N/A

raulsntos commented 1 year ago

The language does not seem to be saved in the plugin.cfg file so, when opening the dialog, the OptionMenu contains whatever the default value is (GDScript).

Here's the part of the code that opens the dialog and sets the field values:

https://github.com/godotengine/godot/blob/b2dc7f26c3ba1e0ac01bae18c22a753ad2606520/editor/plugin_config_dialog.cpp#L176-L181

We either need to save the language in the plugin.cfg or try to guess it from the Script Name extension.

Note that this does not affect the plugin, the language field is only used for validation. Godot will use the language that corresponds to the script file's extension, so if the file ends with .cs it will instantiate it as a CSharpScript and should work as expected.