[PATCH] D38048: [clangd] Add textDocument/signatureHelp

Francisco Lopes da Silva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 10:29:03 PDT 2017


francisco.lopes added a comment.

In https://reviews.llvm.org/D38048#887960, @ilya-biryukov wrote:

> Another case where this might be bad is overloaded functions. I may choose one overload in completion, but `signatureHelp` will initially point into a different one.


Hi,  I'd just like to comment on this aspect to inform how  this is done is different ways for Vim.

Original YouCompleteMe, for example, still doesn't support parameter hints, so it just offers function prototypes in the completion menu, for functions foo(int, char) and
foo(void *, int), the two prototypes gets listed and not mattering what function the user selects the text to be inserted will always just be the same function name, foo.

I didn't find this useful because it cluttered the menu with many overloads that the user may not be in fact looking for, it may be targeting for another function but it gets
like ten long overloads of another function that's ranked first according to what the user typed.

I also didn't find it useful, in Vim, to show full prototypes in  the pop up menu because for C++ they tend to be rather long.

So I changed YouCompleteMe this way:

- Just show unique function names in the popup menu (they're tagged as functions).
- When the user selects a given function, the overloads are shown in a separate preview window instead, which for me is more sane for showing long information.
- When the user goes about filling the call site with arguments, the overloads in the preview window are dynamically updated showing the current argument the user is at, for the remaining compatible overloads.
- The overloads get reduced while the user fill arguments as well as there's type resolution of generic functions along the way.

These pictures show how this happens:

- https://s3.amazonaws.com/f.cl.ly/items/1e2F0A123h331c1G0L0R/SadBart.gif
- https://imgur.com/a/OqFaI

They just don't happen illustrate the reduction of multiple overloads because I didn't put multiple ones at the time.

This is just to illustrate some different completion approach that tries to be inline with libclang offerings.


https://reviews.llvm.org/D38048





More information about the cfe-commits mailing list