Bug 572941 - Function auto-complete fills random parameters increasing potential developer errors
Summary: Function auto-complete fills random parameters increasing potential developer...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.18   Edit
Hardware: Macintosh Mac OS X
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 433121
  Show dependency tree
 
Reported: 2021-04-18 12:30 EDT by Praveen Balaji CLA
Modified: 2024-02-24 06:15 EST (History)
8 users (show)

See Also:


Attachments
Shows that the autofill arguments can be counter productive (125.47 KB, image/png)
2021-04-19 10:40 EDT, Praveen Balaji CLA
no flags Details
You can change this option and try (166.99 KB, image/png)
2021-06-03 04:37 EDT, Vikas Chandra CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Praveen Balaji CLA 2021-04-18 12:30:21 EDT
When a function is auto-completed, the parameter values are filled with variables from the context. More often than not, the choice of which variable to use is incorrect. This is a productivity killer, but more importantly, could end up in inadvertent bugs unless the developer is extra careful to check that the parameters are correct.

In earlier versions, the values were filled with the actual function parameter names. Would be good to go back to that behavior.
Comment 1 Jeff Johnston CLA 2021-04-18 18:34:26 EDT
Moving to JDT core

Please provide a sample case that exhibits the problem.
Comment 2 Praveen Balaji CLA 2021-04-19 10:40:50 EDT
Created attachment 286167 [details]
Shows that the autofill arguments can be counter productive

This screenshot shows how counter productive the variable inference is. Earlier, it used to just suggest the actual argument names (example, astring1, astring2.. etc. in this case). That had a much better change of getting it right because developers tend to use consistent naming for variables within their own code.
Comment 3 Praveen Balaji CLA 2021-06-02 19:13:07 EDT
Bumping this issue. I ran through into this issue several times in the last few weeks where I almost missed the fact that Eclipse randomly chose parameters which match the type.
Comment 4 Vikas Chandra CLA 2021-06-03 04:09:57 EDT
This got introduced between I20200916-0410 and : I20200930-1800
Comment 5 Vikas Chandra CLA 2021-06-03 04:10:24 EDT
sample code

public class mainclass {
	
	private static String random = "ABC";
	
	public static void main(String[] args) {
		manyArg
	}
	
	public static void manyArg(final String s1, final String s2, final String s3) {
		
	}

}
Comment 6 Vikas Chandra CLA 2021-06-03 04:37:40 EDT
Created attachment 286514 [details]
You can change this option and try
Comment 7 Vikas Chandra CLA 2021-06-03 04:38:17 EDT
(In reply to Vikas Chandra from comment #6)
> Created attachment 286514 [details]
> You can change this option and try

Please change this option and try. See option.png attached
Comment 8 Vikas Chandra CLA 2021-06-03 04:40:28 EDT
Lars, insert best guessed argument leads to error prone code. Do you think we should revert it? ( bug 433121 )
Comment 9 Jay Arthanareeswaran CLA 2021-06-03 04:43:34 EDT
(In reply to Vikas Chandra from comment #8)
> Lars, insert best guessed argument leads to error prone code. Do you think
> we should revert it? ( bug 433121 )

Changing the component to text to reflect this.
Comment 10 Lars Vogel CLA 2021-06-03 04:48:02 EDT
(In reply to Vikas Chandra from comment #8)
> Lars, insert best guessed argument leads to error prone code. Do you think
> we should revert it? ( bug 433121 )

I have no strong opinion on that anymore. Maybe send an email to eclipse-dev asking for feedback?
Comment 11 Noopur Gupta CLA 2021-06-03 05:56:03 EDT
(In reply to Vikas Chandra from comment #7)
> (In reply to Vikas Chandra from comment #6)
> > Created attachment 286514 [details]
> > You can change this option and try
> 
> Please change this option and try. See option.png attached
This preference can be changed to get back the old behavior. 

We will keep this bug open to get more user feedback. Based on that, we can revert it later if required.
Comment 12 Roland Grunberg CLA 2021-06-03 10:00:37 EDT
We switched from parameter arguments to parameter guessing in Bug 433121. I found this feature quite useful. I think we really need some kind of poll to figure out how many people find it useful vs. a pain.

If the only issue with this feature is that it it's annoying in certain cases, is there a way to fix it ? Maybe don't consider static "basic" types in the guessing logic ?

I was less convinced about Bug 423642, but many others seemed to indicate it was their preference.
Comment 13 Noopur Gupta CLA 2021-06-03 10:23:05 EDT
(In reply to Roland Grunberg from comment #12) 
> If the only issue with this feature is that it it's annoying in certain
> cases, is there a way to fix it ? 
Fixing specific issues sounds good.

> I was less convinced about Bug 423642
+1. I find it more error-prone than helpful while coding.
Comment 14 Praveen Balaji CLA 2021-07-06 17:10:08 EDT
(In reply to Vikas Chandra from comment #7)
> (In reply to Vikas Chandra from comment #6)
> > Created attachment 286514 [details]
> > You can change this option and try
> 
> Please change this option and try. See option.png attached

Yes, that option works, thank you.

Given that there is an option to make this work, I would bump this issue down to "annoyance". I still think the default should be "Insert parameter names".
Comment 15 Eclipse Genie CLA 2024-02-24 06:15:56 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.