Thursday, February 17, 2011

Libcharlemagne, Lua, and Haiku

The last couple of weekends I've taken a little time away from writing lessons to find some much-needed refreshment in coding. The target? Lua, oddly enough. I twiddled with it for a while and discovered that as scripting languages go, I have to jump through fewer hoops to get something quick-and-dirty done with Lua than others and the code isn't write-only like Perl.

The first project was a doozy: write a C++ header parser and (later on) dump the parsed C++ information into a SQLite3 database so that I have the hard stuff done for implementing something code completion for Paladin. Code completion has been #1 on my hit list of features for a long time now, but I haven't had a clue where to start to implement it, and ctags sure didn't seem to be a step in the right direction. I've learned enough about Lua to really like it and want to eventually put together an elegant implementation of the Haiku API via libcharlemagne. I haven't gotten to more advanced topics like metatables and such, but I'm pretty sure that the rest will come in time. Once I finish cleaning up PalEdit's internals like I was working on last summer, I can easily see embedding Lua scripting into it for more powerful editing features and plugins.


  1. I think code completion, especially for the Haiku API, would be a great addition to Paladin.

    Will the addition of code completion make it easy to add the feature to "Jump to Definition" of a function or variable?

  2. Jump to Definition is actually very easy to implement because of ctags, but at least in my experience it does next to nothing for simply wanting to look up header declarations, hence my parser. I plan on using ctags to implement a Jump to Definition within projects.

    I want to do one better and use a tooltip-like window to show the lookups, so it won't quite be code completion -- more like a quick lookup function. The way Visual Studio does things slows you down by getting in the way of your typing. My way will avoid such hangups while still giving the user quick access to parameter information. It might even pave the way for a "Jump to Documentation" feature, which would also be really nice to have.