Include "get", "set", and "is" as element prefixes when doing a Java auto-complete search
Description
When a user invokes code completion for a member, which may be a "property" (which we shall call "Foo"), check to see if there is any "getFoo", "setFoo", or "isFoo" in the class and add it to the complete list if it is. The best possibly insertion point I think would be around hither: https://github.com/apache/netbeans/blob/487686125c370140bc39cc8f1d598783f187fdf5/java/java.completion/src/org/netbeans/modules/java/completion/Utilities.java#L102
Use case/motivation
I am actually porting quite a bit of code from C# to Java, and it would be immensely helpful if Netbeans just checked to see if there is a "Bar.getFoo()" when I invoke autocomplete on "Bar.Foo". It would speed things up quite a bit since I wouldn't have to go to the start, type in the "get", "set", or "is", and then move to the end to complete it.
Related issues
No response
Are you willing to submit a pull request?
Yes
Code of Conduct
Yes
sounds reasonable to me. Looking forward to the PR :)
Will I need to make a test too or can I just submit the change?
Will I need to make a test too or can I just submit the change?
would be good to have test case covering it but the completion tests are a bit netbeans specific, so if you are struggling with it I am sure someone else could help.
I would probably put it in org.netbeans.modules.java.completion.JavaCompletionTaskBasicTest. You will probably also have to create a test file for it which would be in java/java.completion/test/unit/data/org/netbeans/modules/java/completion/data
Looking at the other test method might help with figuring out how this works.
here an example of a test which added completion for the record keyword: https://github.com/apache/netbeans/pull/3227/files
Working branch in case I am slow and someone else wants to finish: https://github.com/SirIntellegence/incubator-netbeans/tree/NETBEANS4428
it may be more manageable to create a PR even with a draft status and do not merge label for people to help.
What is the standard for fixing other unrelated tests in the same test suite? Apparently System.out. has a charset() which is not accounted for and is failing 3 of the tests
there is no need to hurry, NetBeans 16 is still far away.
You have to be more specific. The tests should work, you shouldn't have to fix "unrelated tests". I suppose you are not talking about your PR, since the draft you pushed doesn't compile.
Some tests fail for me for some reason that are not related to my modifications. I am going to push a new commit in a bit.
closing since already implemented. See https://github.com/apache/netbeans/pull/4440#issuecomment-1274702374