apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.65k stars 850 forks source link

Show right doc on hover over constructor #7654

Closed subhash-arabhi closed 2 months ago

subhash-arabhi commented 2 months ago

Fixes the issue #7653 Changes:

  1. Added the FindNewClassForConstructor function to skip to the parent if the parent is a new class type.
  2. Added numbers and characters to the list where the offset needs to be incremented.
  3. Added tests for these changes.
lahodaj commented 2 months ago

I would suggest to add testcases for the number and character literals also to JavaDocumentationTaskTest.java, as that will be the test other developers will likely run when adjusting code completion. Tests in java/java.lsp.server are mostly meant for the gluing code between the LSP and the real backend, and do not generally cover all possible problems/combinations.

mbien commented 2 months ago

would need squashing before merge

subhash-arabhi commented 2 months ago

@mbien I squashed the commits, Could you merge the PR

mbien commented 2 months ago

@subhash-arabhi I unlocked CI here. But merging should be done by someone else (assuming tests are green). This is VSCode specific and doesn't influence NetBeans behavior if I understand it correctly due to UX differences.

NetBeans shows the overlay information of the parameter if the mouse is over the parameter, not the constructor doc. For the constructor doc, the user has to hover over the constructor identifier. For the class doc you have to move the mouse over the type - all very intuitive. (https://github.com/apache/netbeans/issues/7653#issuecomment-2278332369)

The bugfix to me would be to show the type info of the param, not the constructor doc IMO.

But I am not going to veto this since a quick manual test showed that this patch does not seem to influence NB. cc @lahodaj

lahodaj commented 2 months ago

Unless there are objections, I'll merge tomorrow.