Bug 569819 - [Completion overwrites] When adding a new parameter completion overwrites existing parameter
Summary: [Completion overwrites] When adding a new parameter completion overwrites exi...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.18   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 423642
  Show dependency tree
 
Reported: 2020-12-18 09:54 EST by Juergen Baier CLA
Modified: 2023-03-06 13:36 EST (History)
2 users (show)

See Also:


Attachments
Situation where an existing parameter is overwritten (2.39 MB, image/jpeg)
2020-12-18 09:54 EST, Juergen Baier CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Baier CLA 2020-12-18 09:54:15 EST
Created attachment 285078 [details]
Situation where an existing parameter is overwritten

There are situations where an existing parameter is overwritten by the "completion overwrites" feature (which is a really great, game-changing feature for me :-) ).

Consider:

public class CompletionOverrides {

	public static void main(String[] args) {
		int arg1 = 1;
		int arg2 = 2;
		foo(arg1, arg2);
	}

	enum MyEnum {
		A, B
	}

	static void foo(int arg1, int arg2) {}
}

1) I change the method signature of foo to

	static void foo(MyEnum arg0, int arg1, int arg2) {}

2) I start fixing the existing call to foo. I put the cursor right after the opening parenthesis:

	public static void main(String[] args) {
		int arg1 = 1;
		int arg2 = 2;
		foo( arg1, arg2);
                    |
                    cursor location
	}

I start typing "MyEnum." and now the autocomplete allows me to choose between one of the enum values. But "arg1" is marked in yellow, so when I choose an enum value "arg1" is overwritten and I get:

	public static void main(String[] args) {
		int arg1 = 1;
		int arg2 = 2;
		foo(MyEnum.A, arg2);
	}

I also added a photo of the situation.

I guess it is not easy to detect if a user wants to overwrite an existing value or to add a new value, but at least in my workflow this seems to happen sometimes.
Comment 1 Eclipse Genie CLA 2023-03-06 13:36:18 EST
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.