I just opened kotlinc
(which apparently defaults to kotlin-jvm
?) and dropped in some hello-world
type code:
data class Person(val name: String, val age: Int) {
val isAdult get() = age >= 20
}
Let's create an instance :
val p = Person("ab", 10)
Hopefully the repl
will offer us the properties via tab
key .. ?
p.<tab>
The repl
beeps on each tab
instead of offering the properties of that Person
instance. "Just in case" I :quit
and opened kotlinc-jvm
explicitly - and got the same behavior. Is it to be believed that there were no code completion
available? Am I missing some option to starting kotlinc
?
Update: JetBrains has now released ki, which supports auto completion (and more).
The kotlin repl currently does not support tab completion. See the official bug tracker for more details: https://youtrack.jetbrains.com/issue/KT-14177, https://youtrack.jetbrains.com/issue/KT-23036
If you use IntelliJ, you may want to try out scratch files. They work well for small bits of code and support code completion.