Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeLens-style Reference Count in NetBeans Java Editor #8230

Open
harshaindunil opened this issue Feb 11, 2025 · 1 comment
Open

CodeLens-style Reference Count in NetBeans Java Editor #8230

harshaindunil opened this issue Feb 11, 2025 · 1 comment
Labels
kind:feature A feature request needs:triage Requires attention from one of the committers

Comments

@harshaindunil
Copy link

Description

Image

Summary
I would like to request a CodeLens-style feature in the NetBeans Java Editor that displays reference counts above methods and classes, similar to Visual Studio. This feature would integrate with the existing Find Usages functionality in NetBeans, allowing users to see and navigate to method/class references efficiently.

Feature Description
This feature would analyze Java source code using the Java Source API and dynamically update a reference count for each method and class. The reference count would be displayed inline above the method/class definition in the editor. Clicking on the reference count should open the existing Find Usages UI, listing all references and allowing users to navigate to each occurrence.

Key Features & Functionality

Display Reference Count Above Methods and Classes

  • Show how many times a method or class is referenced in the project.
  • Update dynamically when the file or project is modified.

Integration with Existing "Find Usages" Feature

  • Clicking on the reference count should trigger Find Usages.
  • Display results using the existing "Find Usages" UI, ensuring consistency with NetBeans’ workflow.

Non-intrusive UI Design

  • Display the reference count inline above the method/class, not in the gutter.
  • Allow enabling/disabling the feature via settings.

Efficient and Performant

  • Perform the analysis in the background using NetBeans Java Source API.
  • Optimize for large projects by leveraging Find Usages indexing instead of scanning files manually.

Why This Feature is Important?

  • Boosts productivity by eliminating the need to manually run "Find Usages" for frequently used methods.
  • Improves code readability by instantly showing usage counts.
  • Enhances navigation by providing quick access to usages through a familiar UI.

Implementation Approach

  1. Use Java Source API to analyze method and class references.
  2. Display reference count annotations above methods/classes in the editor.
  3. On clicking the reference count, invoke the existing Find Usages UI to display results.

Additional Notes
This feature would modernize the NetBeans Java Editor by providing a lightweight but powerful way to navigate code references. Since NetBeans already has a strong Find Usages implementation, this proposal focuses on seamless integration rather than reinventing functionality.

Would love to hear thoughts from the NetBeans team and community!
Thanks for considering this feature request.

Use case/motivation

No response

Related issues

No response

Are you willing to submit a pull request?

No

@harshaindunil harshaindunil added kind:feature A feature request needs:triage Requires attention from one of the committers labels Feb 11, 2025
@Chris2011
Copy link
Contributor

It should be possible by adding this with the virtual text that @jlahoda introduce a while ago. I also wanted to have a look and this is defintely a nice and handy feature, not only for the java editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:feature A feature request needs:triage Requires attention from one of the committers
Projects
None yet
Development

No branches or pull requests

2 participants