fix: Default to an empty sorter, so we always have one

This commit is contained in:
TJ DeVries
2021-04-16 11:11:40 -04:00
parent f2c3f724ad
commit d27907b0da
2 changed files with 7 additions and 1 deletions

View File

@@ -73,7 +73,7 @@ function Picker:new(opts)
_on_input_filter_cb = opts.on_input_filter_cb or function() end, _on_input_filter_cb = opts.on_input_filter_cb or function() end,
finder = opts.finder, finder = opts.finder,
sorter = opts.sorter, sorter = opts.sorter or require('telescope.sorters').empty(),
previewer = opts.previewer, previewer = opts.previewer,
default_selection_index = opts.default_selection_index, default_selection_index = opts.default_selection_index,

View File

@@ -465,6 +465,12 @@ sorters.highlighter_only = function(opts)
} }
end end
sorters.empty = function()
return Sorter:new {
scoring_function = function() return 0 end,
}
end
-- Bad & Dumb Sorter -- Bad & Dumb Sorter
sorters.get_levenshtein_sorter = function() sorters.get_levenshtein_sorter = function()
return Sorter:new { return Sorter:new {