redhat-developer / redhat-developer/vscode-java
"Show Call Hierarchy" should have the ability to filter calls, or apply name filter patterns
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
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 the feature to apply any one of the following options:
- Filter test codes. (unit test codes, or codes residing under
src/test/java) - Apply name filter patterns. (Only includes reference names that matches the given filter patterns.)
- Limit the call depth of a given number. (Only goes down in depth up to the given number, inclusive.)
This feature is similar to Eclipse's "Filter Calls" dialog:

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 with RedHat Java extensions installed.
Environment
- Operating System: Ubuntu 20.04.2 LTS
- JDK version: AdoptOpenJDK 11 (jdk-11.0.11+9)
- Visual Studio Code version: 1.61.2
- Java extension version: v1.0.0 (October 19, 2021)
Steps To Reproduce
- Open any Java class object whose object is used in both the main source code, as well as in the unit test codes.
- On any identifiers (method name, class field name, etc.), do
SHIFT+ALT+Hto invoke "Show Call Hierarchy". - Observe in the list, notice how there aren't any options available to filter certain call invocations from the results. You would have to manually click on the "X" button to remove the entry you don't want, one by one.
Current Result
The "Show Call Hierarchy" looks something like this.

Expected Result
After filtering out either all test codes, or applying a name filter pattern to exclude any references containing "test", it should look something like this:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Show Call Hierarchy entry point in the VS Code Java extension and review how its results are presented. Compare the requested test-code filtering, name patterns, and call-depth limit, then determine the accepted scope. Done means the chosen filtering behavior is available from the call hierarchy UI and covers the stated use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript, vscode
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100