diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-20 23:41:53 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-08-20 23:41:53 -0400 |
| commit | cfddae42f59eacbd792a8853be089f4711bbf4ba (patch) | |
| tree | 9033de9a43822a63544244559380729b8f3d84bf /lua/telescope/sorters.lua | |
| parent | 96cac0a8c861d5cdb1bb7765cc2d20e47ebb7885 (diff) | |
WIP: Actually get the UI to work and add some tests
Diffstat (limited to 'lua/telescope/sorters.lua')
| -rw-r--r-- | lua/telescope/sorters.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lua/telescope/sorters.lua b/lua/telescope/sorters.lua index c97a1a9..0299c91 100644 --- a/lua/telescope/sorters.lua +++ b/lua/telescope/sorters.lua @@ -1,3 +1,4 @@ +local log = require('telescope.log') local util = require('telescope.utils') local sorters = {} @@ -12,7 +13,7 @@ Sorter.__index = Sorter --- --- Lower number is better (because it's like a closer match) --- But, any number below 0 means you want that line filtered out. ---- @param scoring_function function Function that has the interface: +--- @field scoring_function function Function that has the interface: -- (sorter, prompt, line): number function Sorter:new(opts) opts = opts or {} @@ -59,4 +60,14 @@ sorters.get_ngram_sorter = function() } end +sorters.get_levenshtein_sorter = function() + return Sorter:new { + scoring_function = function(_, prompt, line) + local result = require('telescope.algos.string_distance')(prompt, line) + log.info("Sorting result for", prompt, line, " = ", result) + return result + end + } +end + return sorters |
