diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-08 13:23:12 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-08 13:23:12 -0400 |
| commit | 25ed3de0ff1a4ef6e18057b1f4d59f7f1f90b8b1 (patch) | |
| tree | 563410f7b3867c7cf8b7b80ec832af1e0ddd5d45 /lua | |
| parent | 9d894f8229cdece3b5ab8b2d5200f7d2d39ed5e8 (diff) | |
fix: Shortcircuit on nil entries and do not allow string entries
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/telescope/sorters.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lua/telescope/sorters.lua b/lua/telescope/sorters.lua index d77baa5..3f9844d 100644 --- a/lua/telescope/sorters.lua +++ b/lua/telescope/sorters.lua @@ -43,8 +43,8 @@ function Sorter:new(opts) end function Sorter:score(prompt, entry) - -- TODO: Decide if we actually want to check the type every time. - return self:scoring_function(prompt or "", type(entry) == "string" and entry or entry.ordinal, entry) + if not entry or not entry.ordinal then return -1 end + return self:scoring_function(prompt or "", entry.ordinal, entry) end function sorters.new(...) @@ -114,7 +114,7 @@ sorters.get_fuzzy_file = function(opts) scoring_function = function(_, prompt, line) local N = #prompt - if prompt == 0 or N < ngram_len then + if N == 0 or N < ngram_len then -- TODO: If the character is in the line, -- then it should get a point or somethin. return 0 |
