Search code examples
kotlindefinitioncompletion

Kotlin extension functions - completion?


I have watched a few tutorials on learning Kotlin, and I am confused as to the meaning of the word 'completion' as used in the quote below. The speaker is a developer at JetBrains, and this is taken from a transcript (not youtube subtitles):

Here, we define an extension function to string called lastChar, and we can use it as a member function. It's visible in completion, so it can be easily discovered. It's like a regular utility function defined outside of the class. But on the other hand, thanks to completion, it can be easily found and used like it was a member.

What is the meaning of the word completion in this usage?

Thank you.


Solution

  • Once you type . after an object, you can see all its member and extension functions and properties in the auto-completion box. Their point is that an extension makes this possible for what would otherwise be a utility function that you would have to remember by name.

    enter image description here