MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.73k stars 255 forks source link

Dont sort everything for c++ autocomplete #810

Open laoshaw opened 3 years ago

laoshaw commented 3 years ago

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)

madscientist commented 3 years ago

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 commented 3 years ago

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