Rename to "locality bonus"

This commit is contained in:
Dmytro Meleshko 2021-11-15 20:23:15 +02:00
parent 4ab258c3cc
commit c6a71a9237
2 changed files with 3 additions and 3 deletions

View File

@ -62,7 +62,7 @@ end
``` ```
## Distance-based sorting ## Locality bonus comparator (distance-based sorting)
This source also provides a comparator function which uses information from the word indexer This source also provides a comparator function which uses information from the word indexer
to sort completion results based on the distance of the word from the cursor line. It will also to sort completion results based on the distance of the word from the cursor line. It will also
@ -80,7 +80,7 @@ cmp.setup({
}, },
sorting = { sorting = {
comparators = { comparators = {
function(...) return cmp_buffer:compare_word_distance(...) end, function(...) return cmp_buffer:compare_locality(...) end,
-- The rest of your comparators... -- The rest of your comparators...
} }
} }

View File

@ -102,7 +102,7 @@ source._get_distance_from_entry = function(self, entry)
end end
end end
source.compare_word_distance = function(self, entry1, entry2) source.compare_locality = function(self, entry1, entry2)
if entry1.context ~= entry2.context then if entry1.context ~= entry2.context then
return return
end end