rad
01/24/2025, 2:18 PMpublic class SoundEvent(
/** Whether this sound should replace vanilla's sound. */
public val replaceVanilla: Boolean = true,
/** The translation key of the subtitle that should be displayed. */
public val subtitle: String? = null,
/** The sound set of this sound event. */
public val soundSet: MutableList<Key> = mutableListOf(),
)
But adding a comment to the constructor like this does not show in my IDE:
public class SoundEvent /** Some text */ public constructor(
/** Whether this sound should replace vanilla's sound. */
public val replaceVanilla: Boolean = true,
/** The translation key of the subtitle that should be displayed. */
public val subtitle: String? = null,
/** The sound set of this sound event. */
public val soundSet: MutableList<Key> = mutableListOf(),
)
I can add comments to secondary constructors, but not on primary ones. How can I do this?Michael Krussel
01/24/2025, 2:30 PM@constructor
/**
* Class
*
* @constructor a constructor
*/
Everything after the @constructor
applies to the constructor including @param
and @param
above it is the type parameters for the class.Michael Krussel
01/24/2025, 2:32 PMMichael Krussel
01/24/2025, 2:32 PMpublic class SoundEvent
/** Some text */ public constructor(
/** Whether this sound should replace vanilla's sound. */
public val replaceVanilla: Boolean = true,
/** The translation key of the subtitle that should be displayed. */
public val subtitle: String? = null,
/** The sound set of this sound event. */
public val soundSet: MutableList<Key> = mutableListOf(),
)
rad
01/24/2025, 2:33 PM@constructor
but that seems to apply to all constructors and not only the primary one. The solution you just showed looks pretty weird syntactically to be honestrad
01/24/2025, 2:37 PMMichael Krussel
01/24/2025, 2:40 PM@constructor
then you see the documentation in quick documentation only if the class has no documentation, otherwise you see the class's documentation. The newlines don't make a difference.
I didn't use the @constructor
or @property
options in the class documentation because they don't export out to the objective-c headers.
But I do see the @constructor
working in the IDE. Could be a version thing or something else causing bugs. I'm also surprised that the @constructor
applies to all of them and not just the primary. Probably worth flagging a bug with Intallij. If you're using a different IDE, than all my advice is wrong.rad
01/24/2025, 2:43 PMMichael Krussel
01/24/2025, 2:46 PMrad
01/24/2025, 2:52 PM/**
* A list of sounds in a namespace, akin to a sounds.json.
*/
public class SoundList
/** This constructor does not initialize the namespace, so be careful using it. */
public constructor(
/** The sound events in this sound list. */
public var soundEvents: MutableList<SoundEvent>,
) : ResourcePackElement {
public constructor(
/** The namespace of this sound list. */
namespace: String,
/** The sound events in this sound list. */
soundEvents: MutableList<SoundEvent> = mutableListOf(),
) : this(soundEvents) {
this.namespace = namespace
}
}
Dokka shows this:Michael Krussel
01/24/2025, 2:53 PM