Bug 562130 - 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:
Summary: When using the "Alt + /" smart code prompt to select a method, Eclipse insert...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.16   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 562258 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-04-14 22:24 EDT by xh z CLA
Modified: 2024-03-30 15:28 EDT (History)
1 user (show)

See Also:


Attachments
Please refer to the document for detailed operation (103.52 KB, application/octet-stream)
2020-04-14 22:24 EDT, xh z CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description xh z CLA 2020-04-14 22:24:13 EDT
Created attachment 282444 [details]
Please refer to the document for detailed operation

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:

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?

Like, IntelliJ IDEA, VisualStudio do not need to manually delete useless parameter content like this
You can use the selected method to replace the current method body content including method parameters and other information

Please refer to the document for detailed operation

System: win10 enterprise x64
STS4: 4.6 x64
Memory: 8GB
Hard disk: 5400 rpm
JDK: 1.8

I hope you or the Eclipse IDE team can solve this problem. thank you very much!
Comment 1 xh z CLA 2020-04-14 22:27:55 EDT
This problem cannot be solved by Preferences-> Java-> Editor-> Content-Assist.
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
Comment 2 Stephan Herrmann CLA 2020-04-15 17:10:05 EDT
I believe I understand what you are saying, but let me double check:

(In reply to xh z from comment #0)
> When using the "Alt + /" smart code prompt to select a method,

On my box "Alt+/" does nothing, may I assume you mean normal code completion? (by default on Ctrl+space).


> Eclipse inserts the current method body behavior by default,

you probably don't mean "body", right? As far as I can see this is about call arguments (incl. the surrounding pair of parantheses), right?

> which will lead to the
> following situation, which is very frustrating:
> Please see the picture for the process description:

(A word document just to show us three pictures is really not the most accessible format ...)
 
> Can you see it? The previous method body still needs to be manually deleted,
> which is very troublesome in coding.

I agree this is annoying.
 
> 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?

We *are* Eclipse IDE developers, no need to transfer... :)
 
Actually, the requested functionality basically exists: see the preference Java > Editor > Content assist > Insertion > (o) Completion overwrites

Try it, it will likely make you happy.

I can confirm, however, that this feature is not perfect:

* it is not the default so many people will not know about it

* my preferred mode is to keep it at (o) Completion inserts and use Ctrl to toggle when I mean "overwrite" BUT this option is not available when Ctrl+space already inserts, because only one proposal matches, so there's no chance to hit Ctrl+Enter :(


I seem to recall this has already been discussed in some previous bug. Anybody remembers?
Comment 3 Stephan Herrmann CLA 2020-04-17 07:49:00 EDT
*** Bug 562258 has been marked as a duplicate of this bug. ***
Comment 4 Eclipse Genie CLA 2022-04-08 02:31:36 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Eclipse Genie CLA 2024-03-30 15:28:59 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.