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

No code assist on enum value while typing a switch statement #762

Closed
mauromol opened this issue Nov 7, 2018 · 2 comments
Closed

No code assist on enum value while typing a switch statement #762

mauromol opened this issue Nov 7, 2018 · 2 comments
Assignees
Milestone

Comments

@mauromol
Copy link

mauromol commented Nov 7, 2018

Consider the following enum:

package test40;
public enum MyEnum {
	FOO, BAR;
}

And the following Groovy class:

package test40
class Test40 {
	void foo() {
		MyEnum e = MyEnum.FOO
		switch(e) {
			case MyEnum.FO|
		}
	}
}

Let the cursor be at "|" and invoke code assist to complete MyEnum.FOO: no suggestion is given.

@eric-milles
Copy link
Member

Ready to test.

Some things are not going to work as you may expect, like:

switch (e) {
case |
}

will probably not propose the enum type. And completion will not hide enum values that are already present in other case labels. And fields, methods, etc. that match the switch type are not boosted to the top of the proposals.

Lastly, Groovy does not support the same form of switch for enums:

switch (e) {
case ONE:
case TWO:
}

I have requested this support in the past; you can track progress if interested: https://issues.apache.org/jira/browse/GROOVY-8444

@mauromol
Copy link
Author

The described use case is fixed in 3.2.0.xx-201811182243-e48, but indeed having code assist propose the enum values when no character is typed would be desirable. I'm going to open a new issue for that.

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

No branches or pull requests

2 participants