[cfe-dev] bug? in ast_matchers::dynamic::Parser::completeExpression

Samuel Benzaquen sbenza at google.com
Mon Dec 15 09:01:32 PST 2014


On Sat, Dec 13, 2014 at 8:26 PM, mobi phil <mobi at mobiphil.com> wrote:

> further hacking clang-query, not sure if it is a bug or lack of feature:
> if I have a text like
>
> varDecl(hasName("aa"
>
> the completion should propose or automatically complete the parentheses,
> as many as possible. For complex expressions that would be of a great help.
> Not sure if this is a bug in LineEdit or the completeExpression or it is
> just a lack of feature.
>

It is just lacking that feature.
The completion logic knows the arity of methods, so it could determine if
all the arguments have been passed and add closing parentheses.
In the example above, it should know that hasName() only takes one argument
and simply close it. It should not close varDecl() as it is variadic and
there could be more arguments coming.

Something else: wonder how much sense it makes for others, but in the code
> analysis I am doing it would be very useful to have strings (names)
> completed as appropriate. Having the correct strings completed would also
> give a hint if the expression written so far is what I want. Wold this be
> difficult to implement?
>

There are a some cases where autocomplete of literal strings make sense.
equalsBoundNode() is one of them. You might also want to repeat names
within subexpressions of anyOf()/eachOf().

Both these features would be in the dynamic::Parser class.

_Sam


>
>
>
> rgrds,
> mobi phil
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141215/3df351d4/attachment.html>


More information about the cfe-dev mailing list