[vim/vim] Modify matchfuzzypos() to also return the list of matching scores (#7596)

10 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Jan 1, 2021, 3:48:46 PM1/1/21
to vim/vim, Subscribed

Some Vim plugins need the fuzzy match score to do additional operations.
Modify the matchfuzzypos() function to also return the fuzzy match score.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/7596

Commit Summary

  • Modify matchfuzzypos() to also return the list of matching scores

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

codecov[bot]

unread,
Jan 1, 2021, 3:55:32 PM1/1/21
to vim/vim, Subscribed

Codecov Report

Merging #7596 (1ba1ee8) into master (edc10b5) will increase coverage by 0.42%.
The diff coverage is 78.57%.

Impacted file tree graph

@@            Coverage Diff             @@

##           master    #7596      +/-   ##

==========================================

+ Coverage   86.53%   86.95%   +0.42%     

==========================================

  Files         147      147              

  Lines      162837   160000    -2837     

==========================================

- Hits       140905   139126    -1779     

+ Misses      21932    20874    -1058     
Flag Coverage Δ
huge-clang-none ?
huge-gcc-testgui 86.91% <78.57%> (?)
huge-gcc-unittests 2.49% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/search.c 92.02% <78.57%> (-0.07%) ⬇️
src/libvterm/src/mouse.c 0.00% <0.00%> (-46.67%) ⬇️
src/mouse.c 48.60% <0.00%> (-38.96%) ⬇️
src/clipboard.c 61.11% <0.00%> (-20.78%) ⬇️
src/clientserver.c 71.46% <0.00%> (-14.72%) ⬇️
src/term.c 66.98% <0.00%> (-14.42%) ⬇️
src/beval.c 67.96% <0.00%> (-13.10%) ⬇️
src/ex_cmds2.c 79.84% <0.00%> (-9.67%) ⬇️
src/main.c 81.09% <0.00%> (-5.22%) ⬇️
src/popupmenu.c 77.79% <0.00%> (-4.13%) ⬇️
... and 124 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update edc10b5...1ba1ee8. Read the comment docs.

Prabir Shrestha

unread,
Jan 2, 2021, 3:18:40 AM1/2/21
to vim/vim, Subscribed

Any plans to also pass custom scores?

Yegappan Lakshmanan

unread,
Jan 2, 2021, 10:48:14 AM1/2/21
to vim_dev, reply+ACY5DGCQWB5MNDIRR4...@reply.github.com, vim/vim, Subscribed
Hi,

On Sat, Jan 2, 2021 at 12:18 AM Prabir Shrestha <vim-dev...@256bit.org> wrote:

Any plans to also pass custom scores?



I am not clear on how a plugin author will use the custom score.
To pick a score for a match, the plugin author needs to understand how
the fuzzy matching score is computed internally in Vim. Otherwise,
there is no guarantee that the plugin supplied scores will be higher
or preferred over the internally computed scores.

If a plugin needs to prioritize some matches over others (from your
example, the most recently used entries), can it merge the preferred
matches with the list of matches returned by matchfuzzypos()?

Regards,
Yegappan

vim-dev ML

unread,
Jan 2, 2021, 10:48:28 AM1/2/21
to vim/vim, vim-dev ML, Your activity

Bram Moolenaar

unread,
Jan 2, 2021, 11:48:21 AM1/2/21
to vim...@googlegroups.com, Yegappan Lakshmanan, reply+ACY5DGCQWB5MNDIRR4...@reply.github.com

Prabir Shrestha wrote:

> > Any plans to also pass custom scores?
>
> I am not clear on how a plugin author will use the custom score.
> To pick a score for a match, the plugin author needs to understand how
> the fuzzy matching score is computed internally in Vim. Otherwise,
> there is no guarantee that the plugin supplied scores will be higher
> or preferred over the internally computed scores.
>
> If a plugin needs to prioritize some matches over others (from your
> example, the most recently used entries), can it merge the preferred
> matches with the list of matches returned by matchfuzzypos()?

I also think that a custom score is not useful. You can always do your
own fuzzy matching (and using a :def function it might be fast enough).
Using a callback for a custome score won't help much.

--
From "know your smileys":
:-)-O Smiling doctor with stethoscope

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

vim-dev ML

unread,
Jan 2, 2021, 11:48:37 AM1/2/21
to vim/vim, vim-dev ML, Your activity

Bram Moolenaar

unread,
Jan 2, 2021, 12:32:00 PM1/2/21
to vim/vim, vim-dev ML, Comment

Closed #7596 via 9d19e4f.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages