utopia-rise / godot-kotlin-jvm

Godot Kotlin JVM Module
MIT License
562 stars 38 forks source link

Rework KotlinLanguage to fix editor script operations #579

Closed CedNaru closed 3 months ago

CedNaru commented 5 months ago

fix https://github.com/utopia-rise/godot-kotlin-jvm/issues/525

Because of the way the Godot script API is done., we can't really dissociate Scripts from the language they use. The consequence being is that it's hard to work with .gdj files and .kt files from the editor at the same time. We want the users to mostly interact with .gdj, but we are also required to provide them with a bug free editor, which was not the case until now when it comes to attaching and creating scripts. In this case, we want them to attach .gdj but create .kt files.

The solution to this is a bit of brute force, but the only one I could manage to make work. I implemented 2 different languages: One for Kotlin file and one for registration files. With that, users can freely use and attach Kotlin or Registration files. Each with their pros and cons (explained in the updated documentation).

The gist of it is that registration are a bit harder to use (because they need to be generated and people will intuitively want to use .kt files) but much more flexible.

PS: I will probably add a Java language too so people can create and attach Java files as well, for parity with Kotlin files.

Edit from @chippmann : Resolves #582

CedNaru commented 3 months ago

image

Here what the UI looks like for the two languages. Given that .gdj are language-agnostic, I simply named the "language" JVM with its official logo. the penguin jvm logo. (Edit from @chippmann )