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

Missing suggestions for static methods in code assist when parser recovery involved #501

Closed
mauromol opened this issue Feb 28, 2018 · 6 comments
Assignees
Labels
Milestone

Comments

@mauromol
Copy link

Consider the following:

package test24
import java.text.NumberFormat
class Test24 {
	static main(args) {
			NumberFormat.|
			Set<Integer> s = []
	}
}

Invoke code assist at "|" with Ctrl+Space and start typing getN: getNumberInstance is not shown as a suggestion. Press Esc and Ctrl+Space again: voilà!
If you remove the following line (Set<Integer> s = []), code assist works fine from the beginning.

@eric-milles
Copy link
Member

Because of optional semicolons in Groovy, you are completing on the expression NumberFormat.|Set<Integer> ... which parses much differently than NumberFormat.| followed by semicolon or } or a keyword like if. If you want to insert in the middle of a section of code, starting with a semicolon and then adding any partial stuff should give you completion similar to end of block editing.

@eric-milles eric-milles self-assigned this Aug 22, 2018
@eric-milles eric-milles added this to the v3.1.0 milestone Aug 22, 2018
@eric-milles
Copy link
Member

Ready to test

@mauromol
Copy link
Author

Tested with 3.1.0.xx-201808212342-e47, but it does not work as expected. In the exact case I attached here, when invoking Ctrl+Space at NumberFormat.|, I just get NumberFormat.Field completion. If I invoke it at NumberFormat.getN| it works though.
However, if you hit Ctrl+Space with NumberFormat.|; (note the trailing semicolon), it works as expected.

@eric-milles
Copy link
Member

Okay, yes. I was testing without the generics on the Set declaration. Without that, the proposals come normally.

eric-milles added a commit that referenced this issue Aug 22, 2018
@eric-milles
Copy link
Member

Ready to test. Recovery is very specific to this case; you may find other cases where it breaks down.

@mauromol
Copy link
Author

Works well in 3.1.0.xx-201808221857-e47, thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants