summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorSimon Hauser <Simon-Hauser@outlook.de>2022-04-03 13:33:33 +0200
committerSimon Hauser <Simon-Hauser@outlook.de>2022-04-03 13:33:33 +0200
commit6e7ee3829225d5c97c1ebfff686050142ffe5867 (patch)
tree87504b1f83bd421cb7c7bf2a30be031cbad99537 /lua
parentd38ad438f3bb4e3721b9964172c8c9d70d5d06a8 (diff)
chore: reformat with stylua 0.13
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/sorters.lua18
-rw-r--r--lua/tests/automated/entry_display_spec.lua32
-rw-r--r--lua/tests/automated/pickers/find_files_spec.lua10
3 files changed, 28 insertions, 32 deletions
diff --git a/lua/telescope/sorters.lua b/lua/telescope/sorters.lua
index 167a67b..8e266b3 100644
--- a/lua/telescope/sorters.lua
+++ b/lua/telescope/sorters.lua
@@ -382,15 +382,15 @@ sorters.get_generic_fuzzy_sorter = function(opts)
-- TODO: Copied from ashkan.
local denominator = (
- (10 * match_count / #prompt_ngrams)
- -- biases for shorter strings
- -- TODO(ashkan): this can bias towards repeated finds of the same
- -- subpattern with overlapping_ngrams
- + 3 * match_count * ngram_len / #line
- + consecutive_matches
- + N / (contains_string or (2 * #line)) -- + 30/(c1 or 2*N)
-
- )
+ (10 * match_count / #prompt_ngrams)
+ -- biases for shorter strings
+ -- TODO(ashkan): this can bias towards repeated finds of the same
+ -- subpattern with overlapping_ngrams
+ + 3 * match_count * ngram_len / #line
+ + consecutive_matches
+ + N / (contains_string or (2 * #line)) -- + 30/(c1 or 2*N)
+
+ )
if denominator == 0 or denominator ~= denominator then
return -1
diff --git a/lua/tests/automated/entry_display_spec.lua b/lua/tests/automated/entry_display_spec.lua
index b57e3a3..a09ccae 100644
--- a/lua/tests/automated/entry_display_spec.lua
+++ b/lua/tests/automated/entry_display_spec.lua
@@ -2,23 +2,21 @@ local entry_display = require "telescope.pickers.entry_display"
describe("truncate", function()
for _, ambiwidth in ipairs { "single", "double" } do
- for _, case in
- ipairs {
- { args = { "abcde", 6 }, expected = { single = "abcde", double = "abcde" } },
- { args = { "abcde", 5 }, expected = { single = "abcde", double = "abcde" } },
- { args = { "abcde", 4 }, expected = { single = "abc…", double = "ab…" } },
- { args = { "アイウエオ", 11 }, expected = { single = "アイウエオ", double = "アイウエオ" } },
- { args = { "アイウエオ", 10 }, expected = { single = "アイウエオ", double = "アイウエオ" } },
- { args = { "アイウエオ", 9 }, expected = { single = "アイウエ…", double = "アイウ…" } },
- { args = { "アイウエオ", 8 }, expected = { single = "アイウ…", double = "アイウ…" } },
- { args = { "├─┤", 7 }, expected = { single = "├─┤", double = "├─┤" } },
- { args = { "├─┤", 6 }, expected = { single = "├─┤", double = "├─┤" } },
- { args = { "├─┤", 5 }, expected = { single = "├─┤", double = "├…" } },
- { args = { "├─┤", 4 }, expected = { single = "├─┤", double = "├…" } },
- { args = { "├─┤", 3 }, expected = { single = "├─┤", double = "…" } },
- { args = { "├─┤", 2 }, expected = { single = "├…", double = "…" } },
- }
- do
+ for _, case in ipairs {
+ { args = { "abcde", 6 }, expected = { single = "abcde", double = "abcde" } },
+ { args = { "abcde", 5 }, expected = { single = "abcde", double = "abcde" } },
+ { args = { "abcde", 4 }, expected = { single = "abc…", double = "ab…" } },
+ { args = { "アイウエオ", 11 }, expected = { single = "アイウエオ", double = "アイウエオ" } },
+ { args = { "アイウエオ", 10 }, expected = { single = "アイウエオ", double = "アイウエオ" } },
+ { args = { "アイウエオ", 9 }, expected = { single = "アイウエ…", double = "アイウ…" } },
+ { args = { "アイウエオ", 8 }, expected = { single = "アイウ…", double = "アイウ…" } },
+ { args = { "├─┤", 7 }, expected = { single = "├─┤", double = "├─┤" } },
+ { args = { "├─┤", 6 }, expected = { single = "├─┤", double = "├─┤" } },
+ { args = { "├─┤", 5 }, expected = { single = "├─┤", double = "├…" } },
+ { args = { "├─┤", 4 }, expected = { single = "├─┤", double = "├…" } },
+ { args = { "├─┤", 3 }, expected = { single = "├─┤", double = "…" } },
+ { args = { "├─┤", 2 }, expected = { single = "├…", double = "…" } },
+ } do
local msg = ("can truncate: ambiwidth = %s, [%s, %d] -> %s"):format(
ambiwidth,
case.args[1],
diff --git a/lua/tests/automated/pickers/find_files_spec.lua b/lua/tests/automated/pickers/find_files_spec.lua
index f5ca05d..e9094cb 100644
--- a/lua/tests/automated/pickers/find_files_spec.lua
+++ b/lua/tests/automated/pickers/find_files_spec.lua
@@ -15,12 +15,10 @@ describe("builtin.find_files", function()
tester.run_file "find_files__with_ctrl_n"
end)
- for _, configuration in
- ipairs {
- { sorting_strategy = "descending" },
- { sorting_strategy = "ascending" },
- }
- do
+ for _, configuration in ipairs {
+ { sorting_strategy = "descending" },
+ { sorting_strategy = "ascending" },
+ } do
it("should not display devicons when disabled: " .. disp(configuration), function()
tester.run_string(string.format(
[[