[cfe-dev] [RFC][PATCH] Implementation for completion in call context for C++
Francisco Lopes
francisco.mailing.lists at oblita.com
Mon Jan 5 13:15:48 PST 2015
Hi,
I've improved completion in call context to work with C++'s templates,
member functions, et al.
Notice: an important aspect of this implementation is that I've took freedom
to change the previous behavior for completion in call context at all.
As can be seen, in lib/Sema/SemaCodeComplete.cpp this comment:
// When we're code-completing for a call, we fall back to ordinary
// name code-completion whenever we can't produce specific
// results. We may want to revisit this strategy in the future,
// e.g., by merging the two kinds of results.
was changed to this:
// When we're code-completing for a call, we DON'T fall back to ordinary
// name code-completion whenever we can't produce specific
// results. This will do "parameter completion" solely.
// I think "parameter completion" is not a good classification, since this
// is useful solely for providing hints and not code-completing.
The rationale behind this change is:
- The former comment shows that completion in call context is still not
in a definite state, open to discussion.
- I firmly believe this new behavior is for good. In call context, 99% of
the time, code authoring tools will be interested in information about
the
prototype and arguments solely, not in all possible kinds of expressions
that can fit as an argument. This behavior turns the interface slower
than
necessary to have almost no benefit.
So I believe that completion in call context just after '(' and ','
should
work similarly as for member access: only provide what's of interest,
which
parametric information (function prototypes, current argument, parameter
types, etc.).
Despite this, I should be able revert to the former behavior in the change
set
without much trouble, in case there's no agreement on this, while still
providing the new set of completions.
The following is a video that covers the new behavior, so that's easy to see
what got changed. It's based on the test set that's part of the patch:
https://vimeo.com/115990512
The change set can be browsed here:
https://github.com/oblitum/clang/tree/improved_argument_hints
The Subversion compatible patch:
https://gist.github.com/oblitum/d24d7d2f9c6ee5cdcea1
This got started for YouCompleteMe:
https://github.com/Valloric/YouCompleteMe/pull/1300
TODO:
Functors (classes that overload operator()), Constructors, ...
(I've already obtained commit access)
Att,
Francisco Lopes
PS: I'm actively looking for a job, remote or relocation, any help very much
appreciated!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150105/25708fe2/attachment.html>
More information about the cfe-dev
mailing list