Code completion in Cantor script editor

Some months ago I wrote about the new features available in Cantor from KDE 4.13 release. But I did not write about a new nice feature available in that release too – so let’s see the new code completion in Cantor script editor!

I coded a default syntax highlighting to each backend in script editor. Script editor is based on KatePart/KTextEditor, a great piece of code from KDE libs used in several KDE softwares like KWrite, Kate, Kile, KDevelop, and more.

The Kate guys released a new feature in KDE 4.13 release: an improved code completion for all languages supported by KTextEditor. It use the same XML file to syntax highlighting from each language to provide this new code completion.

As I coded the default syntax highlighting, the code completion for the script editor was enabled as default too. Amazing!

So, let’s see some pictures about this feature:

code-completion-scilab-cantor

Code completion in Scilab

This figure we use code completion to write a plot command in script editor from Scilab backend.

code-completion-maxima-cantor

Code completion in Maxima

In Maxima backend we can see the code completion working not only to the commands with initial string typed: for example, contour_plot is suggested in the figure.

This new code completion is available to all backends that have the script editor plugin implemented. To use it you just type Ctrl+Space in the editor.

There are some improvements to this feature to be implemented in the future. For example, it would be interesting load the functions to modules/packages imported in the editor – for example, in Python I can use import numpy and the numpy functions could be available in code completion too. The variables in the Cantor workspace could be available in the script editor too.

But it is work to the future. For now, you can have fun with this new code completion., and thanks for all Kate developers for this nice feature!

2 thoughts on “Code completion in Cantor script editor

  1. For Python, it would be interesting to think about whether one can integrate KDevelop’s Python support. I would love to have something (semi-)interactive with its code completion ;)
    I guess KDevelop could simply be used as the script editor eventually …?

    1. Hi @Sven! Your work with kdev-python is really great. I would like to provide a script editor to Cantor based in your work with python, but I need to study how I can to do it. The script editor in Cantor is really “minimal” yet, it need several improvements…

      Maybe it will be a work after the kf5 port. =)

Leave a Reply

Your email address will not be published. Required fields are marked *