I've just released version 0.1.2 of Kapshot, a com...
# feed
d
I've just released version 0.1.2 of Kapshot, a compiler plugin that allows Kotlin code to access fragments of its own source text at runtime. 0.1.2 adds support for capturing the source of property declarations. This complements the existing support for class, method and block capture. Write self-testing sample code!
Copy code
val captured = CapturedBlock {
    println("Hello!")
}

@CaptureSource
val myVal = 10

/* ... */

captured.source.text // == "println(\"Hello!\")"

sourceOf(::myVal).text // == "val myVal = 10"
https://github.com/mfwgenerics/kapshot
👏 8
😮 3
👍 7
🤔 1
a
Wow. Looks interesting!
p
Wow. That's brilliant!
c
Interesting idea🤩