Is it possible / How to find/list all closures in a defined area?

Hello community!

I need to know, where I have closures in my code. (How) Can I find/list them all in a file/directory in PhpStorm `v2017.2.1`?

Thanks

0
Avatar
Permanently deleted user

Hello,

There's View > Tool Windows > Structure - usually all code structures are displayed there.

For searching there's Edit > Find > Find in Path that will display search results in a preview list or in a separate window.

0

In the View > Tool Windows > Structure are displayed elements of the curretly open class. It doesn't work for a folder. And it also doesn't display closures.

In Edit > Find > Find I cannot say "show me all closures" -- and it would be actually, what I need.

0

Hi there,

There is no dedicated "Find closures/lambdas" functionality.

The "easiest" option -- some clever regex (which would see the difference between method declaration and actual closure) .. or just search for generic "function" and then filter out unwanted entries (you can remove individual entries from search results)

I'm not sure if Structural Search will be of any use here (I've no real idea on how to tell it to look for closures only + little to no experience in using this tool).

1

请先登录再写评论。