Skip to content

Poor experience with code assist #288

@mauromol

Description

@mauromol

Inspired by a code snippet in the old GRECLIPSE-1797.

Consider the following code (you need JUnit 4 in the buildpath):

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|
	}
}

Place the cursor at "|" and invoke code assist. Accept assertNull as a completion. You'll get:

assertNull(

Now type "m." and expect to get "m.doSomething" suggested: you get nothing instead!
To get suggestions you absolutely need to add a closing bracket corresponding to the opened bracket of assertNull( invocation, which however was node added by the first completion, so you need to be in this situation:

assertNull(m.|)

Now, invoke code assist again and acceot "m.doSomething", the result is:

assertNull(m.|doSomething()

In other words, the closing bracket of the surrounding invocation of "assertNull" was swallowed.

So, I think there are three problems here (let me know if you prefer me to open separate issues for one or more of them):

  1. probably the first code completion should also add the closing bracket for the call to assertNull()
  2. in any case, in this and many other situations, I find it extremely annoying and unproductive that, if I'm missing the closing bracket for the sorrounding method invocation, I can't get a proper code assist on the argument I'm typing (m.doSomething() in this case). I know this might have something to do with the Groovy parser and its resilience to (temporary) syntax errors, but if Greclipse could handle this correctly it would be an GIANT improvement. (this was filed as the old GRECLIPSE-1796)
  3. when invoking code assist for the inner method invocation, the surrounding closing bracket gets swallowed

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions