mirror of
https://github.com/hrsh7th/cmp-buffer
synced 2025-05-03 00:30:49 +00:00
Rename to "locality bonus"
This commit is contained in:
parent
4ab258c3cc
commit
c6a71a9237
@ -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
|
||||
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 = {
|
||||
comparators = {
|
||||
function(...) return cmp_buffer:compare_word_distance(...) end,
|
||||
function(...) return cmp_buffer:compare_locality(...) end,
|
||||
-- The rest of your comparators...
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ source._get_distance_from_entry = function(self, entry)
|
||||
end
|
||||
end
|
||||
|
||||
source.compare_word_distance = function(self, entry1, entry2)
|
||||
source.compare_locality = function(self, entry1, entry2)
|
||||
if entry1.context ~= entry2.context then
|
||||
return
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user