Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Code completion with partial matching

<< < (8/9) > >>

dmoore:
Seems to mostly work, but in python, with completion on "os." then type "mod" I get: "mknod, chmod, fchmod, removedirs" in that order

I expected to only see chmod and fchmod, because the other two aren't exact matches for mod or acronyms that include mod.

dmoore:
Also, with the disappointing lack of useful namespace usage in C++, I can see why you would want the "adaption" algorithm, but at least for python it seems less of a necessity. It would be good to cleanly decouple that functionality from the basic functionality, so that it can be easily switched off. (I haven't read your code closely so maybe that's already done.) Another approach would be to give priority to tokens that are used in the local file, but I'm guessing that would be quite a bit trickier to implement.

Another thing that occurrs to me is that we only use the YCM style filtering to limit the already created list of items that match the typed prefix before CC opens, not what is actually add to the list in the first place. This is probably for the best?


--- Quote from: Alpha on April 16, 2014, 04:17:07 am ---Another thought: the adaption mechanism can be made more deterministic running it in 'learning mode' for a session.  Afterwards (in subsequent sessions), use the results as static data to run the heuristics.

--- End quote ---

Seems like if you would use it at all that it may as well be always running. Over time your coding evolves... Maybe just need a way of limiting the size of the dictionary, or a way of making sure that stuff that hasn't been used in a while get de-prioritized?

Alpha:

--- Quote from: dmoore on April 17, 2014, 04:17:15 pm ---Seems to mostly work, but in python, with completion on "os." then type "mod" I get: "mknod, chmod, fchmod, removedirs" in that order [...]

--- End quote ---
"mod" matches all of them because "mknod" and "removedirs".  "mknod" is first, because it starts with the same character that you first typed; "chmod" and "fchmod" are next because the contain an exact match of "mod".  This the (current) behaviour of the prioritization.


--- Quote from: dmoore on April 17, 2014, 05:15:31 pm ---Also, with the disappointing lack of useful namespace usage in C++, I can see why you would want the "adaption" algorithm, but at least for python it seems less of a necessity. It would be good to cleanly decouple that functionality from the basic functionality, so that it can be easily switched off. (I haven't read your code closely so maybe that's already done.) Another approach would be to give priority to tokens that are used in the local file, but I'm guessing that would be quite a bit trickier to implement.

--- End quote ---
Not exactly clean :) , but the two easiest ways to disable are either comment out the line that searches the cache, or disable the function that adds items to the cache (or both).
Priority of local tokens would have to be done on the plugin end, however, the infrastructure is already supported.  If the plugin marks local tokens with a lower (meaning better) priority, the sorting algorithm boosts their score (assuming that these priority tokens account for less than 1/4 of the total tokens).


--- Quote from: dmoore on April 17, 2014, 05:15:31 pm ---Another thing that occurrs to me is that we only use the YCM style filtering to limit the already created list of items that match the typed prefix before CC opens, not what is actually add to the list in the first place. This is probably for the best?

--- End quote ---
Sort of; CCManager sends the plugins a "fake" context, that is at most one character long.  That seemed to provide an acceptable balance showing applicable results, and cost of building/filtering a large list.


--- Quote from: dmoore on April 17, 2014, 05:15:31 pm ---Seems like if you would use it at all that it may as well be always running. Over time your coding evolves... Maybe just need a way of limiting the size of the dictionary, or a way of making sure that stuff that hasn't been used in a while get de-prioritized?

--- End quote ---
Currently, the dictionary is not saved on close.  However, when making it persistent, I think saving only the 64 (or some other magic constant) most recently (or perhaps frequently?) used entries to the config file, would be a good option.

dmoore:

--- Quote from: Alpha on April 23, 2014, 04:47:36 pm ---"mod" matches all of them because "mknod" and "removedirs".  "mknod" is first, because it starts with the same character that you first typed; "chmod" and "fchmod" are next because the contain an exact match of "mod".  This the (current) behaviour of the prioritization.

--- End quote ---

I understood that, I just think it's bad. At a minimum, the exact matches should get priority over inexact matches, but I'm not really convinced that you should match imperfect matches at all unless they fit the acronym rules. (That's what my pseudocode was attempting to do)

Alpha:
What about, for example: clanccgcext -> clang_codeCompleteGetContexts() (from libClang)?  Imperfect matches allow typing a longer name by (mentally) skipping through, typing only the parts where it differentiates from the other items listed.
I find my typing habit often is: type a prefix (to bring up autocomp), enter acronym for the remaining parts, (if choice is still "far") enter suffix.

(I still am trying to get used to this; it is a completely different way of thinking.)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version