https://kotlinlang.org logo
Title
t

Thanos Psaridis

03/21/2018, 12:00 PM
Hello guys Kotlin noob here. I have declared some top level functions inside
Utils.kt
file which I'm calling them in another class but how can someone else find out that those functions reside in the
Utils.kt
file just by reading at my code? If you ctrl+click on function IntelliJ takes me to the
Utils.kt
file but how can I do that without the help of the ide?
h

hho

03/21/2018, 12:02 PM
If you're using them from another package, you'll have to
import
them - that's how to know where they come from.
t

Thanos Psaridis

03/21/2018, 12:12 PM
yeah I just need to import the name of the function e.g
com.mypackage.roundNumber
but I don't actually know that
roundNumber()
function resides in
Utils.kl
file
s

spand

03/21/2018, 12:14 PM
I think you will have to look at all files in the package
Use grep 🙂
h

hho

03/21/2018, 12:14 PM
Use an IDE. Nobody is coding without one anyway.
t

Thanos Psaridis

03/21/2018, 12:16 PM
haha @hho true but I was considering the scenario where I just do a quick reading from a github repo and stumble upon a function like that and need to know what it does so I need to find a the appropriate file without the help of ide
@spand
grep
could be a good solution if you have the files stored in your pc but I was thinking of the scenario I described above ☝️
h

hho

03/21/2018, 12:20 PM
I think Github's code search might be working as a
grep
replacement in that case.
t

Thanos Psaridis

03/21/2018, 12:22 PM
oh yeap you are right @hho didn't think of that 😛 thanks