count method usage

Answered

Hi,

Is there a way to count and have an overview of how many times a method or function is called in the code ?

Thank you

1
4 comments

Hi,

You could use the Find Usages. Place the cursor at the function name, double-click Shift and type Find Usages.

There you can see how many times the function is used in the code. However, it will also show other function usages (e.g. print(foo)), not only the calls.

It can also be used for variables, classes, etc.
If you would like a feature to count only the function calls, please feel free to submit a feature request about it to our issue tracker using the link https://youtrack.jetbrains.com/issues/PY

0

I was more thinking about a list of the methods/functions in a column and their calls in another one, more like a statistic feature. But thanks anyway.

1

Yes I would like this feature to.

 

Something like this...

 

8 times - public function myFunc1
2 times - public function myFunc2

When learning a new PHP project it would be nice to see which methods are important.
0

i think this could help:

   Settings -> Editor -> Inlay Hints -> Code Vision -> Usages

it works for Java

(but not yet possible for Scala as far as I've experienced).

1

Please sign in to leave a comment.