chore: add stylua to format the codebase, and run on CI (#1055)

This commit is contained in:
Kiyan
2022-03-06 17:33:30 +01:00
committed by GitHub
parent 76d181d480
commit 0816064a8b
43 changed files with 871 additions and 732 deletions

View File

@@ -1,31 +1,31 @@
local M = {}
function M.get_padding(depth)
return string.rep(' ', depth)
return string.rep(" ", depth)
end
local function get_padding_arrows(icon_state)
return function(depth, _, _, node)
if node.nodes then
local icon = icon_state.icons.folder_icons[node.open and 'arrow_open' or 'arrow_closed']
return string.rep(' ', depth - 2)..icon..' '
local icon = icon_state.icons.folder_icons[node.open and "arrow_open" or "arrow_closed"]
return string.rep(" ", depth - 2) .. icon .. " "
end
return string.rep(' ', depth)
return string.rep(" ", depth)
end
end
local function get_padding_indent_markers(depth, idx, tree, _, markers)
local padding = ""
if depth ~= 0 then
local rdepth = depth/2
local rdepth = depth / 2
markers[rdepth] = idx ~= #tree.nodes
for i=1,rdepth do
for i = 1, rdepth do
if idx == #tree.nodes and i == rdepth then
padding = padding..''
padding = padding .. ""
elseif markers[i] then
padding = padding..''
padding = padding .. ""
else
padding = padding..' '
padding = padding .. " "
end
end
end
@@ -33,7 +33,7 @@ local function get_padding_indent_markers(depth, idx, tree, _, markers)
end
function M.reload_padding_function()
local icon_state = require'nvim-tree.renderer.icons'.get_config()
local icon_state = require("nvim-tree.renderer.icons").get_config()
if icon_state.show_folder_icon and icon_state.show_folder_arrows then
M.get_padding = get_padding_arrows(icon_state)