Rob N
Rob N

Reputation: 16399

Tell Eclipse to auto-complete only method name?

Let's say I'm editing a line...

obj.fooBar(x, y, z);

I want to change the method name to fooSomethingElse, but keep most of the arguments. If I delete all or part of the name, and then use content assist, it completes the method name, but starts a new arg list...

obj.fooSomethingElse(arg1, arg2)(x, y, z)
                     ^---- this arg is highlighted for editing

I often have to delete "(arg1, arg2)". I can turn off "fill method arguments" in preferences and then I only have to delete "()", but it's still annoying. Is there another command to complete only the method name. Ideally it would just be a separate command and key combo from the general purpose content-assist, so I can invoke either one as needed.

Upvotes: 14

Views: 2033

Answers (2)

Deepak Azad
Deepak Azad

Reputation: 7923

Essentially you are looking for a way to toggle between inserting and replacing via content assist. The default behavior is to insert. You can toggle this behavior while inside the content assist selection dialog by pressing and holding the Ctrl key while selecting the completion.
More inforation - http://blog.deepakazad.com/2012/06/jdt-tip-toggle-between-inserting-and.html

Upvotes: 17

jjathman
jjathman

Reputation: 12604

I think you just need to press tab instead of enter to autocomplete it. Then it will keep your existing parameters.

Upvotes: 0

Related Questions