Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign
Code completion with partial matching
dmoore:
See: https://github.com/Valloric/YouCompleteMe/blob/master/README.md
--- Quote ---A critical thing to notice is that the completion filtering is NOT based on the input being a string prefix of the completion (but that works too). The input needs to be a subsequence match of a completion. This is a fancy way of saying that any input characters need to be present in a completion string in the order in which they appear in the input. So abc is a subsequence of xaybgc, but not of xbyxaxxc. After the filter, a complicated sorting system ranks the completion strings so that the most relevant ones rise to the top of the menu (so you usually need to press TAB just once).
--- End quote ---
The animated GIF has a nice little demonstration. Cool feature IMO.
Alpha:
Enjoy attached hack ;) . (To cc_interface branch.)
(Edit: Filtering, but no fancy sorting.)
dmoore:
Nice work! It works nicely with the python cc plugin too!
How much of an issue is the sorting? Does the popup list allow you to control the sort order? The most important thing is that (1) exact prefix matches come first (2) exact infix or suffix matches next and, maybe, (3) other matches by count of neighboring letters that match. Giving priority for the acronym of CamelCase symbols would be a nice touch too. (e.g. return AbstractBaseClass with high priority for abc, and maybe getNextCharacter would be high on the list for gnc)
PS: Seems to be small bug with placement of doc string window. Sometimes it places on left when there clearly isn't room for the whole window on that side. (edited)
Alpha:
--- Quote from: dmoore on January 18, 2014, 05:05:52 pm ---How much of an issue is the sorting? [...]
--- End quote ---
It is not really an issue; only that a sort function would need to be written.
--- Code: (close to line 580) ---m_FilteredTokens.erase(remove_if(m_FilteredTokens.begin(), m_FilteredTokens.end(), Matcher), m_FilteredTokens.end());
std::sort(m_FilteredTokens.begin(), m_FilteredTokens.end(), MyFancySort); // add sorting here
--- End code ---
That line (plus the definition of the "MyFancySort" - or whatever name is chosen) should be all that is necessary.
--- Quote from: dmoore on January 18, 2014, 05:05:52 pm ---PS: Seems to be small bug with placement of doc string window. Sometimes it places on left when there clearly isn't room for the whole window.
--- End quote ---
Well, that was supposed to be a feature. Does it act unexpectedly?
oBFusCATed:
--- Quote from: Alpha on January 18, 2014, 07:46:51 pm ---It is not really an issue; only that a sort function would need to be written.
--- End quote ---
Probably it would be better to use some ranking function, converting the string to some integer and then using normal integer sorting.
Probably YouCompleteMe dev won't mind if you use theirs way of sorting.... :)
Navigation
[0] Message Index
[#] Next page
Go to full version