diff --git a/plug-in-development/index.html b/plug-in-development/index.html index 1843830..8808065 100644 --- a/plug-in-development/index.html +++ b/plug-in-development/index.html @@ -302,10 +302,7 @@ class Info(val publish: Boolean)
@Directive -public fun myConfig(init: Info.() -> Unit) = Info().apply { - init() - this -}+public fun myConfig(init: Info.() -> Unit) = Info().apply { init() }
The @Directive
annotation is not enforced but you should always use it in order to help future tools (e.g. an IDEA plug-in) identify Kobalt directives so they can be treated differently from regular Kotlin functions. The code above defines a myConfig
function that accepts a closure as an argument. It creates an Info
object, calls the init()
function on it (which runs all the code inside that closure) and then return that Info
object.