chore: use stylua for formatting (#1040)
* chore: stylua job and config * reformat with stylua
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
local strings = require('plenary.strings')
|
||||
local strings = require "plenary.strings"
|
||||
|
||||
local entry_display = {}
|
||||
entry_display.truncate = strings.truncate
|
||||
@@ -9,7 +9,7 @@ entry_display.create = function(configuration)
|
||||
if v.width then
|
||||
local justify = v.right_justify
|
||||
table.insert(generator, function(item)
|
||||
if type(item) == 'table' then
|
||||
if type(item) == "table" then
|
||||
return strings.align_str(entry_display.truncate(item[1], v.width), v.width, justify), item[2]
|
||||
else
|
||||
return strings.align_str(entry_display.truncate(item, v.width), v.width, justify)
|
||||
@@ -17,7 +17,7 @@ entry_display.create = function(configuration)
|
||||
end)
|
||||
else
|
||||
table.insert(generator, function(item)
|
||||
if type(item) == 'table' then
|
||||
if type(item) == "table" then
|
||||
return item[1], item[2]
|
||||
else
|
||||
return item
|
||||
@@ -37,7 +37,7 @@ entry_display.create = function(configuration)
|
||||
for j = 1, (i - 1) do
|
||||
hl_start = hl_start + #results[j] + (#configuration.separator or 1)
|
||||
end
|
||||
local hl_end = hl_start + #str:gsub('%s*$', '')
|
||||
local hl_end = hl_start + #str:gsub("%s*$", "")
|
||||
|
||||
if type(hl) == "function" then
|
||||
for _, hl_res in ipairs(hl()) do
|
||||
@@ -66,7 +66,7 @@ entry_display.create = function(configuration)
|
||||
local final_str = table.concat(results, configuration.separator or "│")
|
||||
if configuration.hl_chars then
|
||||
for i = 1, #final_str do
|
||||
local c = final_str:sub(i,i)
|
||||
local c = final_str:sub(i, i)
|
||||
local hl = configuration.hl_chars[c]
|
||||
if hl then
|
||||
table.insert(highlights, { { i - 1, i }, hl })
|
||||
@@ -78,21 +78,20 @@ entry_display.create = function(configuration)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
entry_display.resolve = function(self, entry)
|
||||
local display, display_highlights
|
||||
if type(entry.display) == 'function' then
|
||||
self:_increment("display_fn")
|
||||
if type(entry.display) == "function" then
|
||||
self:_increment "display_fn"
|
||||
display, display_highlights = entry:display(self)
|
||||
|
||||
if type(display) == 'string' then
|
||||
if type(display) == "string" then
|
||||
return display, display_highlights
|
||||
end
|
||||
else
|
||||
display = entry.display
|
||||
end
|
||||
|
||||
if type(display) == 'string' then
|
||||
if type(display) == "string" then
|
||||
return display, display_highlights
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user