chore: reformat with stylua 0.13

This commit is contained in:
Simon Hauser
2022-04-03 13:33:33 +02:00
parent d38ad438f3
commit 6e7ee38292
4 changed files with 33 additions and 35 deletions

View File

@@ -382,15 +382,15 @@ sorters.get_generic_fuzzy_sorter = function(opts)
-- TODO: Copied from ashkan. -- TODO: Copied from ashkan.
local denominator = ( local denominator = (
(10 * match_count / #prompt_ngrams) (10 * match_count / #prompt_ngrams)
-- biases for shorter strings -- biases for shorter strings
-- TODO(ashkan): this can bias towards repeated finds of the same -- TODO(ashkan): this can bias towards repeated finds of the same
-- subpattern with overlapping_ngrams -- subpattern with overlapping_ngrams
+ 3 * match_count * ngram_len / #line + 3 * match_count * ngram_len / #line
+ consecutive_matches + consecutive_matches
+ N / (contains_string or (2 * #line)) -- + 30/(c1 or 2*N) + N / (contains_string or (2 * #line)) -- + 30/(c1 or 2*N)
) )
if denominator == 0 or denominator ~= denominator then if denominator == 0 or denominator ~= denominator then
return -1 return -1

View File

@@ -2,23 +2,21 @@ local entry_display = require "telescope.pickers.entry_display"
describe("truncate", function() describe("truncate", function()
for _, ambiwidth in ipairs { "single", "double" } do for _, ambiwidth in ipairs { "single", "double" } do
for _, case in for _, case in ipairs {
ipairs { { args = { "abcde", 6 }, expected = { single = "abcde", double = "abcde" } },
{ args = { "abcde", 6 }, expected = { single = "abcde", double = "abcde" } }, { args = { "abcde", 5 }, expected = { single = "abcde", double = "abcde" } },
{ args = { "abcde", 5 }, expected = { single = "abcde", double = "abcde" } }, { args = { "abcde", 4 }, expected = { single = "abc", double = "ab" } },
{ args = { "abcde", 4 }, expected = { single = "abc…", double = "ab…" } }, { args = { "アイウエオ", 11 }, expected = { single = "アイウエオ", double = "アイウエオ" } },
{ args = { "アイウエオ", 11 }, expected = { single = "アイウエオ", double = "アイウエオ" } }, { args = { "アイウエオ", 10 }, expected = { single = "アイウエオ", double = "アイウエオ" } },
{ args = { "アイウエオ", 10 }, expected = { single = "アイウエ", double = "アイウエオ" } }, { args = { "アイウエオ", 9 }, expected = { single = "アイウエ", double = "アイウ" } },
{ args = { "アイウエオ", 9 }, expected = { single = "アイウ", double = "アイウ…" } }, { args = { "アイウエオ", 8 }, expected = { single = "アイウ…", double = "アイウ…" } },
{ args = { "アイウエオ", 8 }, expected = { single = "アイウ…", double = "アイウ…" } }, { args = { "├─┤", 7 }, expected = { single = "├─┤", double = "├─┤" } },
{ args = { "├─┤", 7 }, expected = { single = "├─┤", double = "├─┤" } }, { args = { "├─┤", 6 }, expected = { single = "├─┤", double = "├─┤" } },
{ args = { "├─┤", 6 }, expected = { single = "├─┤", double = "─┤" } }, { args = { "├─┤", 5 }, expected = { single = "├─┤", double = "" } },
{ args = { "├─┤", 5 }, expected = { single = "├─┤", double = "├…" } }, { args = { "├─┤", 4 }, expected = { single = "├─┤", double = "├…" } },
{ args = { "├─┤", 4 }, expected = { single = "├─┤", double = "" } }, { args = { "├─┤", 3 }, expected = { single = "├─┤", double = "" } },
{ args = { "├─┤", 3 }, expected = { single = "─┤", double = "" } }, { args = { "├─┤", 2 }, expected = { single = "", double = "" } },
{ args = { "├─┤", 2 }, expected = { single = "├…", double = "" } }, } do
}
do
local msg = ("can truncate: ambiwidth = %s, [%s, %d] -> %s"):format( local msg = ("can truncate: ambiwidth = %s, [%s, %d] -> %s"):format(
ambiwidth, ambiwidth,
case.args[1], case.args[1],

View File

@@ -15,12 +15,10 @@ describe("builtin.find_files", function()
tester.run_file "find_files__with_ctrl_n" tester.run_file "find_files__with_ctrl_n"
end) end)
for _, configuration in for _, configuration in ipairs {
ipairs { { sorting_strategy = "descending" },
{ sorting_strategy = "descending" }, { sorting_strategy = "ascending" },
{ sorting_strategy = "ascending" }, } do
}
do
it("should not display devicons when disabled: " .. disp(configuration), function() it("should not display devicons when disabled: " .. disp(configuration), function()
tester.run_string(string.format( tester.run_string(string.format(
[[ [[

View File

@@ -1,8 +1,10 @@
-- Setup telescope with defaults -- Setup telescope with defaults
if RELOAD then RELOAD('telescope') end if RELOAD then
require('telescope').setup() RELOAD "telescope"
end
require("telescope").setup()
local docgen = require('docgen') local docgen = require "docgen"
local docs = {} local docs = {}
@@ -32,7 +34,7 @@ docs.test = function()
docgen.write(input_file, output_file_handle) docgen.write(input_file, output_file_handle)
end end
output_file_handle:write(" vim:tw=78:ts=8:ft=help:norl:\n") output_file_handle:write " vim:tw=78:ts=8:ft=help:norl:\n"
output_file_handle:close() output_file_handle:close()
vim.cmd [[checktime]] vim.cmd [[checktime]]
end end