Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve compare_func, neocomplcache#compare_rank a little. #305

Closed
stardiviner opened this issue Oct 27, 2012 · 7 comments
Closed

improve compare_func, neocomplcache#compare_rank a little. #305

stardiviner opened this issue Oct 27, 2012 · 7 comments

Comments

@stardiviner
Copy link
Contributor

Here is a screenshot. http://ompldr.org/vZzFnZg
I think connection10 should below connect9 instead of upper than connect2.
I tried to improve in neocomplcache source code.
But I do not know how to improve on this case. In my intuitive, I think compare_func should compare candidates depend on string and number seperately. Maybe convert the candidate text ? I do not know. And I think this compare_func must be fast. otherwise it will slow down the popup menu.

@Shougo
Copy link
Owner

Shougo commented Oct 27, 2012

I think connection10 should below connect9 instead of upper than connect2.
I tried to improve in neocomplcache source code.

It is difficult. Because the compare function is fully optimized.
And I think your functions behavior does not seem to be a merit that much.

@stardiviner
Copy link
Contributor Author

I have to say, I have no programming experience. So please pardon me if what I said is not sane.
That's why I only give out some ideas or thought, instead of the really code.

And this should be considered as a discuss, I guess.
What about separate candidate into characters.
An example:

candidate1: connect10
candidate2: connect1
candidate3: connect2

after separation:

['c', 'o', 'n', 'n', 'e', 'c', 't', '1', '0']
['c', 'o', 'n', 'n', 'e', 'c', 't', '1']
['c', 'o', 'n', 'n', 'e', 'c', 't', '2']

Them maybe use some algorithm to compare those characters one by one or two per time, or some other algorithms.
I'm totally not good at algorithm.
Actually neocomplcache only has that default compare function neocomplcache#compare_sort().
If neocomplcache can provides other compare_func, even it is heavy. (Maybe just put it in FAQ, instead of neocomplcache source code).

Maybe I can ask on StackOverflow about this compare algorithm. :)

@Shougo
Copy link
Owner

Shougo commented Oct 27, 2012

Maybe I can ask on StackOverflow about this compare algorithm. :)

OK. I will wait.

Actually neocomplcache only has that default compare function neocomplcache#compare_sort().
If neocomplcache can provides other compare_func, even it is heavy. (Maybe just put it in FAQ, instead of neocomplcache source code).

I added FAQ section.

@stardiviner
Copy link
Contributor Author

This is just a link to StackOverflow question

@Shougo
Copy link
Owner

Shougo commented Oct 27, 2012

I added 'neocomplcache#compare_human' function.

let g:neocomplcache_compare_function = 'neocomplcache#compare_human'

@stardiviner
Copy link
Contributor Author

Thanks, I had a look at wikipedia sort algorithms, really difficult to implement. You're right.
And this is the error of my test of the new update.

Error detected while processing function neocomplcache#auto_complete..neocomplcache#manual_complete..neocomplcache#get_complete_words..neocomplcache#compare_human:
line    9:
E684: list index out of range: 1
E15: Invalid expression: words_1[i] ># words_2[i]

By the way, what does the line 9: mean in upper error output ?

@stardiviner
Copy link
Contributor Author

The update fixed the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants