Is there a way to highlight reference to a method?

Consider the case where method foo returns a reference to method bar (not a method call).
Is there a way in PyCharm to apply syntax highlighting specifically to a method reference?

In the example below, I would like bar on line 5 to be highlighted to indicate that it is a method reference (i.e., self.bar, not self.bar()).

1 from typing import Callable
2
3 class FooBar:
4     def foo(self) -> Callable[[], str]:
5        return self.bar
6     
7     def bar(self) -> str:
8         return "foobar!"
0
1 comment

Hi Heidi Holappa, At the moment, PyCharm does not provide a separate syntax highlighting style to distinguish between a method reference and a method call. Both self.bar (reference) and self.bar() (call) use the same highlighting scheme. 

If this distinction would be helpful for your workflow, please consider submitting a feature request on YouTrack.

0

Please sign in to leave a comment.