Wednesday, January 20, 2010

Pydev 1.5.4 released

Yes, Pydev 1.5.4 is out already.

The most noteworthy things done in this release were:

It's now possible to create your own template variables through Jython scripting.

A bug that could deadlock Pydev in a race condition was fixed.

Aside from that, many little things were done:

There are now actions to copy the qualified name of your current context to the clipboard and go to the matching bracket.

The wrap paragraph is now also available in the source menu (it seems many didn't know it existed), and Ctrl+2 will bring up a dialog with the available options (although it can still be completed as before -- in fact, there's a delay in bringing up the dialog so that it doesn't bother if you already know what to choose).

The hover is improved and will actually show the code related to the variable being hovered as well as a link to the definition if hovering over a method or class.

Several minor bugs and enhancements in the grammars used for Python parsing as well as in code analysis and code completion were also done.

The complete details can be seen at http://pydev.org/

Saturday, January 09, 2010

Templates on Pydev (with Jython scripting)

One really nice feature that has just been added to Pydev (available in the nightly build) is the possibility of extending the variables that are available for templates through Jython scripting.

It opens lots of possibilities, as when it's resolved it has access to the python code being edited (and all the available modules and Pydev APIs).

Some default templates were added already taking advantage of that (see: pytemplate_defaults.py as a reference -- the docstring explains how to create your own templates).

The image below shows the variables created in the defaults (already using Jython scripting -- note that when multiple superclasses are available, the ${superclass} variable enables the user to choose which one to use):





This enabled the print template to work as expected (giving only 'print ' in python 2.x and 'print()' in python 3.x, as it can 'know' which grammar you are using).

To finish, 2 other templates were creating taking advantage of the context:
super : super(MyClass, self).CurrentMethod()
super_raw : MySuperClass.CurrentMethod(self)

If anyone has other 'must have' template suggestions now that this is available, those are very welcome.

On a side note, the current nightly build is pretty stable (and should be the new released version unless there's some critical error lying there found in the next 2-3 days), so, it should be safe to get it to experiment with those.