Monday, July 17, 2006

Improving code-completion in pydev

The next release is taking a bit longer than usual, but I think it'll be worth it ;-)

The last releases were pretty much focused on getting pydev more efficient -- with lots of profiling -- and stable, and in this next release, I'll focus on features again (mostly on code-completion).

Calltips is one of those long-awaited features that can make your life so much easier, and will be added in this release (and needs no presentations), but as this release is focusing on features, it'll also add:

Toggling the completion mode

That's one of those things that's hard to explain... But I'll try it:

When you're in a piece of code such as

foo.doIt(a, b)

and you want to do a completion to change the method 'doIt' (after 'do') for 'doItNow', it would usually do: 'foo.doItNow(xx,yy)It(a,b)', and you'd have to delete that part with '(xx,yy)It' after applying the completion. Now, in the new release, after bringing the completions up, pressing 'ctrl' (the key that toggles the completion mode) will replace the rest of the method for the new completion, and don't put the parentesis if there is one already.

Cycling through completions

Now, pressing Ctrl+Space multiple types will cycle through the default completions and templates completion (so, if you're looking for a hard-to-find template, just press Ctrl+Space one more time).

Linked Mode

After applying some completion, if it has parameters, you'll be able to cycle through the arguments with Tab and pressing Enter will exit this mode and place the cursor just after the call.


Jonathan Ellis said...

shouldn't the completion replacement mode be the default, since that's what pretty much everyone else does?

Fabio Zadrozny said...

Hummm... could be, but I'm not sure about it. I've tried to keep the behaviour close to the java editor completions in this one. So... let me think about it ;-)

Tim van der Leeuw said...

I thought that this new behaviour was default for the Java editors ... ?

Fabio Zadrozny said...

Actually not... you have to hit the toggle key (Ctrl) for having that behaviour (I made this implementation based on the same behaviour gotten in the java editor).

Fabio Zadrozny said...

Actually, seeing the preferences in the java editor, the default is the one I implemented, but it gives you a choice on which one should be used as default... I think pydev should follow that (giving the user an option so that he can choose which one should be the default)

Anonymous said...

Ctrl+Space is occupied bye Input method for non-ascii characters.
and could the auto completion be activated automatic(need not a key to fire it).