This is a quick blog post to say that I'm working on support for the Node.js framework by the KDevelop QML/JS language plugin. The first part of my work is already finished: "require" is properly recognized and Node.js modules are properly looked-up and included. The "exports" and "module.exports" identifiers are also recognized and allow Javascript files to export symbols and to be used as modules. This means that you can now edit Javascript files using Node.js and have most of the modules recognized, included and parsed.

The second part is writing huge Javascript files for the built-in Node.js modules. "http", "buffer", "fs", "url" and many other modules exist only as part of Node.js. There are Javascript files for them in the Node.js Git repository, but these files don't allow the QML/JS plugin to infer the types of the methods. They are also fairly big and would need a big cleanup in order to be fast enough to parse.

As with ECMAScript, I solve the problem by shipping with QML/JS stripped down versions of those files. These files describe the classes, methods and attributes of each module, and follow a very simple format. This code is not designed to be run, only to be parsed by the QML/JS plugin, that will discover the types of the function parameters and their return type.

1 2 exports . spawn = function ( command , args , options ) { return new exports . ChildProcess (); }; exports . spawn ( "" , [], new Object ());

Writing all these files is tiring and will take some time (in fact, I'm writing them for a bit more than one day, now). So, there may be fewer commit than usual in the QML/JS repository, but I hope that this feature will serve many users. Here is a teaser of what is coming (note that functions are now listed in a way more human-friendly form):

Once this feature is finished, I will concentrate my efforts on the QML code-completion. I'll also experiment with the KDE Frameworks 5 (and the KF5 version of KDevelop), because I'd like to offer a KF5 version of the QML/JS plugin. The reason is twofold: Qt5 offers the wonderful QtQuick.Controls module (it will allow me to implement many navigation widget, that will assist the users in choosing a font family, configuring and previewing animations, etc), and early KF5/Plasma5 adopters may be well pleased to be able to use the latest and greatest KDevelop on their latest and greatest environment, while still being able to work on QML and Javascript files.