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

Extend "Add missing import" code action to suggest "static methods"/functions #528

Open
themkat opened this issue Nov 29, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@themkat
Copy link
Collaborator

themkat commented Nov 29, 2023

Currently, the code action for adding missing imports only suggests classes. Often we might want to statically import a Java static method or similar. Those are currently not suggested by the code action. Worked a lot with some static helper methods in a library at work today, so it bothered me enough to create an issue 😛 If nothing else, then as a wishlist item.

Example: We have written the code currentThread() in our editor, and naturally we get an error. Neither the completion (when we wrote it) or the code action (after writing) suggests anything. One possible suggestion would be to import java.lang.Thread.currentThread (aka the static method currentThread).

Unsure on how to solve this. The easiest solution would probably be to put the static methods in the symbol index as well, as we would easily query it that way. The initialization of the server is already slow and consume a lot of memory, so I'm a little bit hesitant to implement it that way. Please let me know if anyone have any suggested solutions 🙂

This is probably true for the completion functionality as well.

@themkat themkat added the enhancement New feature or request label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant