Skip to content

Commit c37f531

Browse files
authored
chore: update stylua (#734)
1 parent 74f4421 commit c37f531

File tree

10 files changed

+48
-53
lines changed

10 files changed

+48
-53
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: JohnnyMorganz/stylua-action@v2
2121
with:
2222
token: ${{ secrets.GITHUB_TOKEN }}
23-
version: v0.15.2
23+
version: v0.16.0
2424
args: --color always --check -g '!**/defaults.lua' lua/
2525

2626
plenary-tests:

lua/neo-tree/events/queue.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ function Queue:for_each(func)
8484
"Handler ",
8585
node.value.id,
8686
" for "
87-
.. node.value.event
88-
.. " returned handled = true, skipping the rest of the queue."
87+
.. node.value.event
88+
.. " returned handled = true, skipping the rest of the queue."
8989
)
9090
return result
9191
end

lua/neo-tree/setup/init.lua

+8-8
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ local prior_window_options = {}
102102
local store_local_window_settings = function(winid)
103103
winid = winid or vim.api.nvim_get_current_win()
104104
local neo_tree_settings_applied, _ =
105-
pcall(vim.api.nvim_win_get_var, winid, "neo_tree_settings_applied")
105+
pcall(vim.api.nvim_win_get_var, winid, "neo_tree_settings_applied")
106106
if neo_tree_settings_applied then
107107
-- don't store our own window settings
108108
return
@@ -121,7 +121,7 @@ end
121121

122122
--- Restore the window options for the current window
123123
--- @param winid number | nil The window id to restore the options for, defaults to current window
124-
local restore_local_window_settings = function (winid)
124+
local restore_local_window_settings = function(winid)
125125
winid = winid or vim.api.nvim_get_current_win()
126126
-- return local window settings to their prior values
127127
local wo = prior_window_options[tostring(winid)]
@@ -159,7 +159,7 @@ M.buffer_enter_event = function()
159159
]])
160160

161161
local winhighlight =
162-
"Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,SignColumn:NeoTreeSignColumn,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit,EndOfBuffer:NeoTreeEndOfBuffer"
162+
"Normal:NeoTreeNormal,NormalNC:NeoTreeNormalNC,SignColumn:NeoTreeSignColumn,CursorLine:NeoTreeCursorLine,FloatBorder:NeoTreeFloatBorder,StatusLine:NeoTreeStatusLine,StatusLineNC:NeoTreeStatusLineNC,VertSplit:NeoTreeVertSplit,EndOfBuffer:NeoTreeEndOfBuffer"
163163
if vim.version().minor >= 7 then
164164
vim.cmd("setlocal winhighlight=" .. winhighlight .. ",WinSeparator:NeoTreeWinSeparator")
165165
else
@@ -499,7 +499,7 @@ M.merge_config = function(user_config, is_auto_config)
499499
restore_local_window_settings()
500500
end
501501
end
502-
vim.api.nvim_create_autocmd({"BufWinLeave"}, {
502+
vim.api.nvim_create_autocmd({ "BufWinLeave" }, {
503503
group = augroup,
504504
pattern = "neo-tree *",
505505
callback = bufleave,
@@ -557,10 +557,10 @@ M.merge_config = function(user_config, is_auto_config)
557557
for source_name, mod_root in pairs(all_sources) do
558558
local module = require(mod_root)
559559
default_config[source_name] = default_config[source_name]
560-
or {
561-
renderers = {},
562-
components = {},
563-
}
560+
or {
561+
renderers = {},
562+
components = {},
563+
}
564564
local source_default_config = default_config[source_name]
565565
source_default_config.components = module.components or require(mod_root .. ".components")
566566
source_default_config.commands = module.commands or require(mod_root .. ".commands")

lua/neo-tree/sources/common/components.lua

+3-7
Original file line numberDiff line numberDiff line change
@@ -262,17 +262,13 @@ M.filtered_by = function(config, node, state)
262262
return result
263263
end
264264

265-
266-
267265
M.icon = function(config, node, state)
268266
local icon = config.default or " "
269267
local highlight = config.highlight or highlights.FILE_ICON
270268
if node.type == "directory" then
271269
highlight = highlights.DIRECTORY_ICON
272270
if node.loaded and not node:has_children() then
273-
icon = not node.empty_expanded
274-
and config.folder_empty
275-
or config.folder_empty_open
271+
icon = not node.empty_expanded and config.folder_empty or config.folder_empty_open
276272
elseif node:is_expanded() then
277273
icon = config.folder_open or "-"
278274
else
@@ -357,14 +353,14 @@ M.indent = function(config, node, state)
357353
local level = node.level
358354
local with_markers = config.with_markers
359355
local with_expanders = config.with_expanders == nil and file_nesting.is_enabled()
360-
or config.with_expanders
356+
or config.with_expanders
361357
local marker_highlight = config.highlight or highlights.INDENT_MARKER
362358
local expander_highlight = config.expander_highlight or config.highlight or highlights.EXPANDER
363359

364360
local function get_expander()
365361
if with_expanders and utils.is_expandable(node) then
366362
return node:is_expanded() and (config.expander_expanded or "")
367-
or (config.expander_collapsed or "")
363+
or (config.expander_collapsed or "")
368364
end
369365
end
370366

lua/neo-tree/sources/filesystem/lib/fs_actions.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,9 @@ M.create_node = function(in_directory, callback, using_root_directory)
355355
if is_dir then
356356
loop.fs_mkdir(destination, 493)
357357
else
358-
local open_mode = loop.constants.O_CREAT + loop.constants.O_WRONLY + loop.constants.O_TRUNC
358+
local open_mode = loop.constants.O_CREAT
359+
+ loop.constants.O_WRONLY
360+
+ loop.constants.O_TRUNC
359361
local fd = loop.fs_open(destination, "w", open_mode)
360362
if not fd then
361363
api.nvim_err_writeln("Could not create file " .. destination)

lua/neo-tree/sources/filesystem/lib/fs_scan.lua

-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ local job_complete = function(context)
139139
render_context(context)
140140
end
141141

142-
143142
local function create_node(context, node)
144143
local success3, item = pcall(file_items.create_item, context, node.path, node.type)
145144
end

lua/neo-tree/ui/renderer.lua

+13-12
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,10 @@ create_nodes = function(source_items, state, level)
246246
local nodeData = {
247247
id = hidden[#hidden].id .. "_hidden_message",
248248
name = "(forced to show "
249-
.. #hidden
250-
.. " hidden "
251-
.. (#hidden > 1 and "items" or "item")
252-
.. ")",
249+
.. #hidden
250+
.. " hidden "
251+
.. (#hidden > 1 and "items" or "item")
252+
.. ")",
253253
type = "message",
254254
level = level,
255255
is_last_child = show_indent_marker_for_message,
@@ -286,7 +286,7 @@ M.render_component = function(component, item, state, remaining_width)
286286
local component_func = state.components[component[1]]
287287
if component_func then
288288
local success, component_data, wanted_width =
289-
pcall(component_func, component, item, state, remaining_width)
289+
pcall(component_func, component, item, state, remaining_width)
290290
if success then
291291
if component_data == nil then
292292
return { {} }
@@ -332,10 +332,11 @@ local prepare_node = function(item, state)
332332
local line = item.line
333333
-- Only use it once, we don't want to accidentally use stale data
334334
item.line = nil
335-
if line
336-
and item.wanted_width
337-
and state.longest_node
338-
and item.wanted_width <= state.longest_node
335+
if
336+
line
337+
and item.wanted_width
338+
and state.longest_node
339+
and item.wanted_width <= state.longest_node
339340
then
340341
return line
341342
end
@@ -363,7 +364,7 @@ local prepare_node = function(item, state)
363364
end
364365
for _, component in ipairs(renderer) do
365366
local component_data, component_wanted_width =
366-
M.render_component(component, item, state, remaining_cols)
367+
M.render_component(component, item, state, remaining_cols)
367368
local actual_width = 0
368369
if component_data then
369370
for _, data in ipairs(component_data) do
@@ -946,8 +947,8 @@ M.window_exists = function(state)
946947
window_exists = false
947948
elseif position == "current" then
948949
window_exists = vim.api.nvim_win_is_valid(winid)
949-
and vim.api.nvim_buf_is_valid(bufnr)
950-
and vim.api.nvim_win_get_buf(winid) == bufnr
950+
and vim.api.nvim_buf_is_valid(bufnr)
951+
and vim.api.nvim_win_get_buf(winid) == bufnr
951952
else
952953
local isvalid = M.is_window_valid(winid)
953954
window_exists = isvalid and (vim.api.nvim_win_get_number(winid) > 0)

lua/neo-tree/utils.lua

+10-11
Original file line numberDiff line numberDiff line change
@@ -836,13 +836,13 @@ local brace_expand_split = function(s, separator)
836836
local depth = 0
837837
while pos <= s:len() do
838838
local c = s:sub(pos, pos)
839-
if c == '\\' then
839+
if c == "\\" then
840840
pos = pos + 1
841841
elseif c == separator and depth == 0 then
842842
return s:sub(1, pos - 1), s:sub(pos + 1)
843-
elseif c == '{' then
843+
elseif c == "{" then
844844
depth = depth + 1
845-
elseif c == '}' then
845+
elseif c == "}" then
846846
if depth > 0 then
847847
depth = depth - 1
848848
end
@@ -897,11 +897,11 @@ local brace_expand_contents = function(s)
897897

898898
---Process numeric sequence expression. e.g. {0..2} -> {0,1,2}, {01..05..2} -> {01,03,05}
899899
local resolve_sequence_num = function(from, to, step)
900-
local format = '%d'
900+
local format = "%d"
901901
-- Pad strings in the presence of a leading zero
902-
local pattern = '^-?0%d'
902+
local pattern = "^-?0%d"
903903
if from:match(pattern) or to:match(pattern) then
904-
format = '%0' .. math.max(#from, #to) .. 'd'
904+
format = "%0" .. math.max(#from, #to) .. "d"
905905
end
906906
return resolve_sequence(from, to, step, function(i)
907907
return string.format(format, i)
@@ -952,7 +952,7 @@ end
952952
---@param s string: input string. e.g. {a..e..2} -> {a,c,e}, {00..05..2} -> {00,03,05}
953953
---@return string[]: result of expansion, array with at least one string (one means it failed to expand and the raw string is returned)
954954
M.brace_expand = function(s)
955-
local preamble, postamble = brace_expand_split(s, '{')
955+
local preamble, postamble = brace_expand_split(s, "{")
956956
if postamble == nil then
957957
return { s }
958958
end
@@ -961,12 +961,12 @@ M.brace_expand = function(s)
961961
postscript = postamble
962962
while contents == nil do
963963
local old_expr = expr
964-
expr, postscript = brace_expand_split(postscript, '}')
964+
expr, postscript = brace_expand_split(postscript, "}")
965965
if old_expr then
966-
expr = old_expr .. '}' .. expr
966+
expr = old_expr .. "}" .. expr
967967
end
968968
if postscript == nil then -- No closing brace found, so we put back the unmatched '{'
969-
preamble = preamble .. '{'
969+
preamble = preamble .. "{"
970970
expr, postscript = nil, postamble
971971
end
972972
contents = brace_expand_contents(expr)
@@ -983,5 +983,4 @@ M.brace_expand = function(s)
983983
return result
984984
end
985985

986-
987986
return M

tests/neo-tree/ui/icons_spec.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ describe("ui/icons", function()
6868

6969
vim.api.nvim_win_set_cursor(winid, { 3, 0 })
7070
u.feedkeys("<CR>")
71-
71+
7272
vim.wait(100)
7373

7474
u.assert_buf_lines(bufnr, {
@@ -107,7 +107,7 @@ describe("ui/icons", function()
107107

108108
vim.api.nvim_win_set_cursor(winid, { 3, 0 })
109109
u.feedkeys("<CR>")
110-
110+
111111
vim.wait(100)
112112

113113
u.assert_buf_lines(bufnr, {
@@ -170,7 +170,7 @@ describe("ui/icons", function()
170170

171171
vim.api.nvim_win_set_cursor(winid, { 3, 0 })
172172
u.feedkeys("<CR>")
173-
173+
174174
vim.wait(100)
175175

176176
u.assert_buf_lines(bufnr, {
@@ -209,7 +209,7 @@ describe("ui/icons", function()
209209

210210
vim.api.nvim_win_set_cursor(winid, { 3, 0 })
211211
u.feedkeys("<CR>")
212-
212+
213213
vim.wait(100)
214214

215215
u.assert_buf_lines(bufnr, {

tests/utils/fs.lua

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@ function fs.create_temp_dir()
99
-- 2. Remove any double separators (on macOS TMPDIR can end in a trailing / which absolute doesn't remove, this should
1010
-- be coverted by https://github.com/nvim-lua/plenary.nvim/issues/330).
1111
local temp_dir = vim.fn.resolve(
12-
Path
13-
:new(
14-
vim.fn.fnamemodify(vim.fn.tempname(), ":h"),
15-
string.format("neo-tree-test-%s", vim.fn.rand())
16-
)
17-
:absolute()
12+
Path:new(
13+
vim.fn.fnamemodify(vim.fn.tempname(), ":h"),
14+
string.format("neo-tree-test-%s", vim.fn.rand())
15+
):absolute()
1816
)
1917
vim.fn.mkdir(temp_dir, "p")
2018
return temp_dir

0 commit comments

Comments
 (0)