Latest blog: PDE Build for OSGi applications | Impressum
  • Categories



  • Suche





    Code navigation in Q Code

    In the past week I got some time to work on QKDT again. First of all, it has been updated to Eclipse 3.5 and now there is also an RCP build for several platforms available.

    The task at hand is to provide code navigation. The DLTK platform already provides indexing of model elements which is the base for various means of code navigation and completion. The question for me was in which way the Q Language fits into the language abstractions which DLTK made and how to hook into DLTK.

    One prerequisite for doing code navigation and completion properly is to know in which context (i.e namespace) the request takes place. Therefore the parser had to be made aware of \d commands and the resulting AST nodes had to be fed into the DLTK model.

    \d .a
    f1: { }
    f2: { }
    // ^ at this place code completion should suggest f1 and f2
    \d .
    5 +
    // ^ however, here it should be .a.f1 and a.f2

    More details can be found in the test spec for code completion.

    The screencast below shows some of the code navigation variants. It starts with a fresh workspace and then imports some Q files from the kx contrib directory. Immediatly after the import the Q files are indexed and the content is available for code navigation, the screencast shows

    • code completion for namespaces and functions
    • the Open Function dialog to search for functions by name
    • code navigation in the Outline view
    • code navigation in the editor using hyperlinks and keyboard shortcuts
    • documentation hover

    Note that code navigation is currently only available for functions. It is quite useful already but of course variable declarations should be covered, too. Unfortunately, the Q parser is still not ready for that. Code navigation now adds motivation to start the daunting task of writing a full Q parser.


    Screencast: Q code navigation

    No comments

    Add comment

    *
    (will not be published)


    *
    Notify me when a new comment is added.