[cfe-dev] Autocompleting functions based on first parameter

Michael Kruse via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 10 12:27:38 PST 2017


2017-01-10 17:26 GMT+01:00 Alex L <arphaman at gmail.com>:
> I think this could be an interesting extension to the current code
> completion engine.
> Although I feel like sometimes it might lead to more annoying clutter that
> users don't want,
> so it would be a good idea to allow users to control it using some global
> setting.

It certainly needs to be opt-in, even if only for the reason that it
might return new ChunkKinds the host program is not prepared for. This
could be an additional flag for CXCodeComplete_Flags. The host program
would then decide whether to expose this option to the user.


>> This could be even more useful for C-style char*. Typing "str" and
>> then triggering autocompletion allows to browse a list of
>> string-related functions, but neither it is complete (eg. atoi won't
>> appear) nor contains only string-related functions (eg.
>> std::streambuf). Typing the argument first and then get a list of
>> operations might be more useful than having to know the operation
>> first.
>
>
> I'm not 100% convinced by the use of this feature for char * completions.
> Would you suggest the free functions for char * after "." or "->" or perhaps
> both?

I am not sure either. One could also add those entries if the cursor
position follows a valid expression, without an additional "." or
"->". On the other side these additional symbols would make the
intention clear to look for an operation instead of eg. a variable
name, and not clutter the normal list with additional entries. It
could also be controlled by flags.

Michael



More information about the cfe-dev mailing list