microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.49k stars 28.65k forks source link

The call hierarchy UI should have the ability to filter calls, or apply name filter patterns #135972

Open tommai78101 opened 2 years ago

tommai78101 commented 2 years ago

Note: This came from VS Code Java extension, referencing the issue here: https://github.com/redhat-developer/vscode-java/issues/2179

When I use Show Call Hierarchy on a property in a Java class object that is frequently used in both the main source code, as well as in the unit tests, the Call Hierarchy list would display a bunch of results. Because, the results include both the main source code and unit tests references, there isn't a way to automatically exclude certain folder directories or paths out from unwanted invocations.

I would like to request for a UI improvement in Visual Studio Code, to allow users apply any one of the following options:

This feature is similar to Eclipse IDE's "Filter Calls" dialog:

image

This is accessed by invoking "Show Call Hierarchy" on a class member, then opening "Filters" in the "More Options" menu in Eclipse IDE.

Currently, we don't have anything similar to this in Visual Studio Code in general (regardless of what language support), where the call hierarchy UI allows the user to filter out what references to look for / ignore.

Environment
Current Result

The "Show Call Hierarchy" looks something like this, whenever we attempt to invoke call hierarchy. I'm using Java language support as an example.

image

Expected Result

Call hierarchy UI with filter options would automatically filter out either all test codes, or applying a name filter pattern to exclude any references containing "test". A mock example should look something like this immediately upon invoking the call hierarchy:

image

jrieken commented 2 years ago

Limit the call depth of a given number. (e.g., Only goes down in depth up to the given number, inclusive.)

Filtering by name or pattern should be possible but I am unsure about the depth because in our UI and API going a level deeper is always a user action. So, instead of picking a number upfront and for all hierarchies, just stop expanding items

tommai78101 commented 2 years ago

@jrieken I think it's fine to leave the call hierarchy depth out, since it's not directly related to filtering the call hierarchy. I only added it in, because I thought it's doable. But I guess I was wrong.

cortexcompiler commented 2 years ago

This would be very helpful. IntelliJ has a similar feature allowing you to filter to just "production" code. The include and exclude capability that is already within vscode Search would do the trick: image

OWissett commented 1 year ago

It would also be nice to be able to filter based on a regex for function signatures

NeonWizard commented 1 year ago

Bump on this. Is this being tracked in a newer issue or is it just stale? This feature seems to be widely requested on stack overflow and other help sites. @jrieken

tommai78101 commented 1 year ago

@NeonWizard If you could help give this feature at the top with a thumbs up, it will allow them to prioritize this feature better. The more thumbs up, the more awareness this feature request will get, the more prioritization.

j1elo commented 11 months ago

What surprises me is that apparently only 13 people (current count of upvotes) use the Show Call Hierarchy feature? Because the minute I discovered and used it for the first time today with my Go project, I thought that it'd be great to filter tests out. Hence here I am, after searching to find if someone had already made the suggestion.

Given that it was immediately apparent to me, as first time user, I definitely expected that it would be for other people too, and this was a more popular feature request. Well I guess not :)

tommai78101 commented 11 months ago

@j1elo I'm pretty sure a lot of people uses the Call Hierarchy feature. They probably just don't realize that filtering the method invocations and classes would help them more.

dreyjey1993 commented 8 months ago

We have very long lists of calls and about 90% of the results are log calls, which make it difficult to find other calls.

So it would be good if there was also the option to exclude results. I would go one step further and implement sorting in addition to filtering.

There could be the following sorting options:

When sorting by name or type, the results found would be grouped.

callain-mirakl commented 7 months ago

I was looking for this feature today, it makes debugging harder when it shows all the tests in the hierarchy

NeonWizard commented 7 months ago

@VSCodeTriageBot We need this issue to be reassigned, Johannes seems to have gone AWOL

tommai78101 commented 7 months ago

@NeonWizard Johannes isn't technically AWOL. He's still active as of last week. It's just that this issue is staying in the backlog, and it hasn't been prioritized as much as the rest of the features that are being put into the upcoming monthly milestone goals.