Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Groovy completion in Default Proposals content assist if only Java Proposals (Code Recommenders) is enabled #290

Closed
mauromol opened this issue May 9, 2017 · 5 comments
Assignees

Comments

@mauromol
Copy link

mauromol commented May 9, 2017

Found while working on #288. Ensure your Eclipse installation has JDT, Mylyn and Code Recommenders (I think Eclipse IDE for Java EE Developers have all three, but I'm not sure). Ensure that the Greclipse option "Guess the most likely parameters for method calls" is CHECKED.
Consider that code snippet:

package a
import static org.junit.Assert.*
import org.junit.After;
import org.junit.Test

final class A {
	MyBean m = new MyBean()

	class MyBean {
		String doSomething(String a, Integer b) {
		}
	}

	@Test final void test() {
		assertNu|
	}
}

Invoke content assist on | and accept assertNull(Object) from the first page of content assist (Default Proposals). The completion should be: assertNull(m). This is fine.

Now open Window | Preferences | Java | Editor | Content Assist | Advanced and UNCHECK both "Java Proposals" and "JavaProposals (Task-Focused)", but leave "Java Proposals (Code Recommenders)" checked.
Now test again the above scenario: the result of completion is: assertNull( (without the argument and with no leading closing bracket).
To get the right completion, you have to cycle through content assist pages and get to Groovy Proposals: if you accept assertNull(Object) from there, then the result completion is fine.

However, I don't think this is the right behaviour. I mean, if I'm using Java Proposals processed by Code Recommenders, I should not need the content assist pages for other Java Proposals (either Task-Focused or not). Also, assertNull(Object) is probably a Groovy proposal in any case, so I expect it to fall into the Default Proposals list in any case, and the result should be consistent in both cases (independently of the Java Proposals preferences). Another clue of this is that if the Greclipse option "Guess the most likely parameters for method calls" is UNCHECKED, the result is consistent independently of the above Java Proposals content assist configuration.

@eric-milles
Copy link
Member

eric-milles commented May 9, 2017 via email

@mauromol
Copy link
Author

mauromol commented May 9, 2017

This however does not explain why code assist breaks only in this specific case (with "Guess the most likely parameters for method calls" CHECKED). Please also note that Code Recommenders is an official Eclipse project (http://www.eclipse.org/recommenders/) and is being part of the Eclipse release train since Juno.
It's also included in the Eclipse IDE for Java EE Developers (http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/neon3) and Eclipse IDE for Java Developers (http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/neon3).

So it's not so much "3rd party" :-)

@eric-milles
Copy link
Member

Can you retest? The proposal categories from Code Recommenders (and others) should be disabled now within a Groovy Editor.

I'm not sure if the preference you mentioned was the real issue. I think opening the preferences with an open Groovy editor and changing the set of proposal categories was the problem. If you do still see odd completion behavior, can you confirm if closing and reopening the Groovy editor clears it up?

@mauromol
Copy link
Author

The real issue is not the mentioned property by itself, but rather the combination of that property being true and the set of enabled proposal categories (if this includes only the Code Recommenders Java proposals without the standard and/or Mylyn Java Proposals category). Tomorrow I will retest and see what happens after your change, thank you!

@mauromol
Copy link
Author

I just tried Greclipse 2.9.2.xx-201705112220-e46.
Now the content assist seems to be consistent, although you changed the wording and position of the options (I think they're better placed now). I would only say that probably "Use guessed arguments for method calls" should be enabled by default... unless you consider it experimental (instead, I had it disabled right now, I don't know whether it's because of previous option changing from me while testing this bug or rather because it's disabled by default).

So, I think the problem I reported is fixed now, thank you very much! 👍

@eric-milles eric-milles self-assigned this Jun 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants