How to autocomplete property name for kotlin field
Answered
Hi there,
I really like Kotlin, but there is something that anoy me.
In java, when I want to declare a variable (field, param or whatever), I start by writing the type name (using autocomplete), and when I have to write the variable name, I usally just hit ctrl-space and IntelliJ suggests a suitable name for the variable.
In kotlin, given that the variable name comes before the type (if required, and I tend to be explicit when the context cannot help the reader of the code to guess the type), I cannot find any convenient way to do that. I'm always have to type the field name manually, then the type name using the autocompletion.
I would really like it if there a better way to do this. Any suggestion ?
Please sign in to leave a comment.
When completing parameter names, Kotlin has special support for showing names and types together in the completion list, based on name/type combinations found elsewhere in the project. There is an open issue for adding the same support when defining properties in a class: https://youtrack.jetbrains.com/issue/KT-13220
Great to see this is planned.