chore: use stylua for formatting (#1040)

* chore: stylua job and config

* reformat with stylua
This commit is contained in:
Simon Hauser
2021-07-23 17:42:37 +02:00
committed by GitHub
parent 664690029f
commit 79644ab677
75 changed files with 3201 additions and 2809 deletions

View File

@@ -7,12 +7,12 @@
-- > matches on consecutive letters and starts of words. This allows matching
-- > using acronyms or different parts of the path." - J Hawthorn
local has_path, Path = pcall(require, 'plenary.path')
local has_path, Path = pcall(require, "plenary.path")
if not has_path then
Path = {
path = {
separator = '/'
}
separator = "/",
},
}
end
@@ -48,11 +48,11 @@ function fzy.has_match(needle, haystack)
end
local function is_lower(c)
return c:match("%l")
return c:match "%l"
end
local function is_upper(c)
return c:match("%u")
return c:match "%u"
end
local function precompute_bonus(haystack)
@@ -93,7 +93,7 @@ local function compute(needle, haystack, D, M)
haystack_chars[i] = lower_haystack:sub(i, i)
end
for i=1,n do
for i = 1, n do
D[i] = {}
M[i] = {}
@@ -147,7 +147,7 @@ function fzy.positions(needle, haystack)
return {}
elseif n == m then
local consecutive = {}
for i=1,n do
for i = 1, n do
consecutive[i] = i
end
return consecutive
@@ -160,11 +160,10 @@ function fzy.positions(needle, haystack)
local positions = {}
local match_required = false
local j = m
for i=n,1,-1 do
for i = n, 1, -1 do
while j >= 1 do
if D[i][j] ~= SCORE_MIN and (match_required or D[i][j] == M[i][j]) then
match_required = (i ~= 1) and (j ~= 1) and (
M[i][j] == D[i - 1][j - 1] + SCORE_MATCH_CONSECUTIVE)
match_required = (i ~= 1) and (j ~= 1) and (M[i][j] == D[i - 1][j - 1] + SCORE_MATCH_CONSECUTIVE)
positions[i] = j
j = j - 1
break