Provide code completion items for field member expressions

Review Request #118465 - Created June 2, 2014 and submitted - Latest diff uploaded

Denis Steckelmacher
This patch adds support for field member expressions ("base.identifier") to the QML/JS code-completion. When "something." is typed by the user, KDevelop displays the list of symbols accessible from the inner context of something. "something" can be any expression recognized by ExpressionVisitor, so this will continue to work when ExpressionVisitor will be able to recognize "table["test"][repository.getIndice()].".

The patch is inspired from how Python handles such completion. The idea is to try to parse as much as possible of the line being edited, in order to have the most complete AST possible. When this is done, ExpressionVisitor is given the current context and visits this partial AST. The declaration it returns (if any) is used to get the code-completion items.

The only thing that doesn't quite please me in this patch is that I parse the current line several times (each time with one character removed from the left). It means that if the user is editing a very long line (say 200 characters), QmlJS::Document::parse will be called up to 200 times! Is there another mean to detect which part of the current line contains a valid expression? Do you think that it would be worth it to complexify the code by trying to skip more than one character each time (for instance, by skipping directly to the next dot or bracket).
Manual testing shows that everything work as expected. For instance, the completions shown at the cursor (|) in this snippet are all the completions valid in button:

Label {
    id: foo
    bar: "baz"

    Button {
        id: button

        property int my_property;

    onTest: {
        console.log(button.|); // my_property listed