Bug 562258

Summary: When using the "Alt + /" smart code prompt to select a method, Eclipse inserts the current method body behavior by default, which will lead to the following situation, which is very frustrating: Please see the picture for the process description:
Product: [Eclipse Project] JDT Reporter: xh z <395053994>
Component: UIAssignee: Stephan Herrmann <stephan.herrmann>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: stephan.herrmann
Version: 4.16   
Target Milestone: 4.16 M3   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
Process demo picture please see none

Description xh z CLA 2020-04-17 07:37:13 EDT
Created attachment 282499 [details]
Process demo picture please see

"Alt + /" smart code prompt to select a method, Eclipse inserts the current method body behavior by default, which will lead to the following situation, which is very frustrating:
Please see the picture for the process description:
Process demo picture please see

Can you see it? The previous method body still needs to be manually deleted, which is very troublesome in coding.
I don't know if this problem can be solved. If it can't be solved, please transfer it to the Eclipse IDE development team to solve it. What do you think?
Other IDEs replace the current method body by default, which is great. Can you understand what I mean by my description?
System: win10 enterprise x64
STS4: 4.6 x64
Memory: 8GB
Hard disk: 5400 rpm
JDK: 1.8
Preferences-> Java-> Editor-> Content-Assist can solve the problem of method name replacement, but the method body, method parameters and other content can not be replaced
Although the method can be replaced, the method body can not be replaced with the selected method body, you still need to manually delete the useless parameter content
Like, idea, visualstudio do not need to manually delete useless parameter content like this

I hope you or the Eclipse IDE team can solve this problem. thank you very much!

Finally, look at STS4's comments
kdvolder commented 3 days ago
If Martin's suggestions doesn't quite do what you want (and I agree personally that the 'overwrite' mode for completions in Eclipse isn't terribly useful) then It sounds like you have a valid complaint to me.

However, this behavior is inherited by STS from Eclipse JDT. STS doesn't directly control it.

If you have a good idea on how to improve this behavior then you could try raising a enhancement request as an Eclipse bugzilla ticket here: https://bugs.eclipse.org/bugs/

If you want to do this, try to be as precise as possible on what behavior you would like as opposed to what it does currently. If you explain it well then there is a decent chance that JDT developers will actually act on your suggestion and try to fix it.

martinlippert commented 2 days ago
@395053994 You are right, the params are not being deleted automatically, I can totally see your point here. I would suggest to raise this with Eclipse JDT via: https://bugs.eclipse.org/bugs/enter_bug.cgi?product=JDT - auto-selects the right project for this. You should select "UI" as the component then, since most of the auto-completion is implemented there.
Comment 1 Stephan Herrmann CLA 2020-04-17 07:48:59 EDT
Don't report the same problem twice, but read the comment I wrote on the first bug.

*** This bug has been marked as a duplicate of bug 562130 ***