You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if there was support for mixins in kotlin.
Note: this is not a duplicate of #722, as that issue does not discuss support for mixins, only supporting kotlin when creating a project.
Currently, when you write a mixin in Java, the following is displayed:
However, if the same mixin is converted to kotlin, the gutter icons are removed, and you cannot control + click on the method text to navigate to the original function:
Note: mixin support can be added for kotlin sources by using kapt in the buildscript. For example:
Although not officially supported by the mixin framework, this does still work, and it is quite useful to write mixins in kotlin, rather than having to do the following everywhere:
YourModInstance.INSTANCE.something.whatever()
or
SomeKotlinObject.INSTANCE.whatever()
Ideally, the following features would be appreciated for kotlin mixins:
adding kotlin mixins to config
gutter icons for navigating to definitions
navigation to method definition
detecting & correcting incorrect method arguments
injects completion
folding method references
I don't believe it should be too difficult to support this, as the code already exists for the Java implementation, and ideally you can just reuse it. However, I have never worked with the IntelliJ plugin api, so I could be incorrect.
The text was updated successfully, but these errors were encountered:
The problem with writing Mixins in Kotlin is that the Kotlin compiler generates a bunch of extra crap which goes on to confuse the Mixin applicator. The reason Kotlin Mixins are bad practice is not because of some vague statement that Mixins are supposed to be written in Java, it does really cause problems in practice, and this is why I don't want to encourage this bad practice in mcdev. I would even go so far as to generate a warning when a Mixin is written in Kotlin.
Hi, I agree with @Earthcomputer, Mixin was designed for java in the first place, so it make unstable the use of kotlin with mixins for the reasons said (it still possible, but you may encounter errors, and cannot profit of the processor and plugin feature).
I recommand to create a service class/object (wrote with kotlin) that contains all the logic, and use it in your java mixin instead .
Minecraft Development for IntelliJ plugin version
2022.3-1.6.1
Description of the feature request
It would be great if there was support for mixins in kotlin.
Note: this is not a duplicate of #722, as that issue does not discuss support for mixins, only supporting kotlin when creating a project.
Currently, when you write a mixin in Java, the following is displayed:
However, if the same mixin is converted to kotlin, the gutter icons are removed, and you cannot control + click on the method text to navigate to the original function:
Note: mixin support can be added for kotlin sources by using kapt in the buildscript. For example:
dependencies { kapt("net.fabricmc:sponge-mixin:0.12.4+mixin.0.8.5") }
Although not officially supported by the mixin framework, this does still work, and it is quite useful to write mixins in kotlin, rather than having to do the following everywhere:
or
Ideally, the following features would be appreciated for kotlin mixins:
I don't believe it should be too difficult to support this, as the code already exists for the Java implementation, and ideally you can just reuse it. However, I have never worked with the IntelliJ plugin api, so I could be incorrect.
The text was updated successfully, but these errors were encountered: