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 code assist trigger with dot ('.') when referencing an object within a 'with' closure #361

Closed
mauromol opened this issue Nov 2, 2017 · 2 comments

Comments

@mauromol
Copy link

mauromol commented Nov 2, 2017

Consider the following Java class:

package test3;

import java.net.URL;

public class MyBean {

	private URL url;
	
	public URL getUrl() {
		return url;
	}
	
	public void setUrl(URL url) {
		this.url = url;
	}
}

The following Groovy class:

package test3

class MyGroovyBean {
  URL expectedUrl
}

And the following class:

package test3

import groovy.transform.CompileStatic

@CompileStatic
class TestDotCompletion {
	void doSomething(MyGroovyBean groovyBean) {
		MyBean b = new MyBean()
		b.with {
			b.url = groo|
		}
	}
}

Invoke code assist at "|", highlight the first suggestion (groovyBean) and use "." (the dot) instead of Enter to accept the proposal: completion is not performed.
This is not coherent, I use "." a lot to accept completion proposals, either in Java or in Groovy.
Please note that if you try to following (more complex) case, it works instead:

  b.url = new MyBe|

Invoke code assist at "|" and use "." to accept the MyBean() suggestion: completion is performed as expected.

@eric-milles
Copy link
Member

Here are the current trigger characters, in case you think there are some keys missing. For any case you run into that these are not causing the completion to be applied, the code is missing a call to setTriggerCharacters.

    /** Triggers for method proposals without parameters. Do not modify! */
    public static final char[] METHOD_TRIGGERS = { ';', ',', '.', '[', ' ', '\t' };

    /** Triggers for method proposals. Do not modify! */
    public static final char[] METHOD_WITH_ARGUMENTS_TRIGGERS = { '(', '{', '-', ' ' };

    /** Triggers for types. Do not modify! */
    public static final char[] TYPE_TRIGGERS = { ';', '.', '=', '[', '(', ' ', '\t' };

    /** Triggers for variables. Do not modify! */
    public static final char[] VAR_TRIGGER = new char[] { ';', '.', '=', '[', '(', '{', ' ', '\t' };

@mauromol
Copy link
Author

mauromol commented Nov 3, 2017

With 2.9.2.xx-201711022118-e46 this works now, thank you! 👍

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