ccls icon indicating copy to clipboard operation
ccls copied to clipboard

Dont sort everything for c++ autocomplete

Open laoshaw opened this issue 3 years ago • 2 comments

currently when I type myvec. or mylist. I saw a long list of autocomplete include many definitions starting with _ or __ that is not useful for real coding, clion will only pick up those real c++ methods instead of listing everything, details with screenshot is listed at https://github.com/neoclide/coc.nvim/issues/3131

is it possible to simplify the autocomplete list via some configuration, looks like the indexer of c++ just pulls in everything, can we filter out some of them in the configuration file(e.g. anything starting with underscore or double underscores)

laoshaw avatar Jun 15 '21 13:06 laoshaw

We can't really remove everything starting with underscore because many coding standards have class data members starting with underscore to avoid overloads with function arguments and local variables. Of course this could be configurable.

Skipping values starting with two underscores is more defensible since these are much more likely to be internal/private/etc. things.

Another idea would be to skip initial non-alphabetic/numeric characters during sorting. So that "_foo" and "bar" would be sorted as "bar", "_foo" rather than "_foo", "bar". I'm not sure how difficult that would be.

madscientist avatar Jun 15 '21 14:06 madscientist

I guess in the context of a C++ symbol "non-alphabetic/numeric characters" means "_" specifically :smirk:

madscientist avatar Jun 15 '21 14:06 madscientist