Note for subscribers: if you are interested in my Ada programming articles only, you can use this RSS feed link.
LEA, the Lightweight Editor for Ada, is based on the Scintilla text editor widget, which excels at colouring syntactic elements and letting the user rework his or her programs very swiftly, including manipulating rectangular selections and adding text on multiple points (usually vertically aligned).
But until recently, the cool features were limited to automatic indentation, adding comment delimiters (--) at the right column, or highlighting portions of text that match a selection.
Users were frustrated by not finding in LEA programming helpers (commonly grouped under the term "smart editor" or "intellisense") that they enjoy in their programming "studios".
An excuse would have been to dismiss such features as out of the scope of a "lightweight" editor.
But we know we can make of LEA a powerful mini-studio, with the ease of use of a simple editor, thanks to its "projectless" mode and the integrated HAC compiler.
So now, it happened.
From revision 385 of LEA (and revision 886 of HAC), you have now a good sense of intellisense:
- mouse-hover tips: when you let the mouse pointer on an identifier for a little while, a tip appears about that identifier (typically, where it was declared)
- context menu with a go-to-declaration entry, when applicable
- call tips: on typing '(' after a subprogram name, a tip appears with the subprogram's parameters
- auto-complete: on typing characters that belong to identifiers, a list of possible declared identifier appears; that list depends on where in the source code the text cursor is: declarations below the cursor are invisible and local declarations, possibly within multiple nested subprograms.
Some screenshots will help illustrate the above points. Let's start with the sudoku_sample.adb example shipped with the HAC project. What's that "Sudo_Strings" type, for instance?
Just let the mouse pointer hang out around an occurrence of that keyword.
|Mouse hover tip - Click image to enlarge it|
Want to know more about that declaration? Right-click on it...
|Go to declaration - Click image to enlarge it|
...and here you go.
|Declaration in the Sudoku package - Click image to enlarge it|
That's it, so far, for features enabling navigation within existing code.
For writing code, here are two other key helpers. First, the call tips.
If we type '(' after a subprogram's name, we see the parameters list appear:
|Call tip - Click image to enlarge it|
If we type the beginning of an identifier, a list of possible completions appears:
|Auto-complete - Click image to enlarge it|
A few remarks about the present state of LEA's "smart editor" features:
- Currently, LEA only supports the HAC subset - it was the first priority. GNAT and other Ada compilers have their own editors and navigation features, so there is a lesser pressure to support them in LEA.
- The "smart editor" features are quite new and still under test and development. If you want to have them, you need to build LEA on a fresh clone (instructions are given in lea.gpr), then set (via regedit) the registry key SMART_EDITOR, in the branch HKEY_CURRENT_USER\SOFTWARE\LEA\, to "true", before starting LEA.
- You will notice a few missing things, like a list of fields on typing '.' after a record variable. They are not forgotten and just still "under construction".
- The "smart editor" features work on incomplete Ada sources. They might be just less present after the point of an error, especially a syntax error.
In order to develop the last point, here are a few examples on how LEA understands your program "on the fly", while you are typing it:
|Smart editor on an incomplete piece of code - Click image to enlarge it|
|Smart editor on an incomplete piece of code, sample 2 - Click image to enlarge it|
|Smart editor on an incomplete piece of code, sample 3 - Click image to enlarge it|
One more thing: the Windows version of LEA is contained in a single executable holding in currently 4.2 MiB, including data such as code samples and templates, and runs as a portable application (no installation required).
Some Web links: