Skip to content

Commit 53b0bca

Browse files
authored
chore: stylua column width 120 -> 140 (#2448)
* chore: stylua column width 120 -> 140 * chore: stylua column width 120 -> 140, tidy * Revert "chore: stylua column width 120 -> 140, tidy" This reverts commit 8a0524d. * chore: stylua column width 120 -> 140, tidy watcher.lua * chore: stylua column width 120 -> 140, tidy diagnostics.lua * chore: stylua column width 120 -> 140, tidy git.lua * chore: stylua column width 120 -> 140, tidy open-file.lua * chore: stylua column width 120 -> 140, tidy system-open.lua * chore: stylua column width 120 -> 140, tidy runner.lua
1 parent 94e572e commit 53b0bca

18 files changed

+38
-114
lines changed

.stylua.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
column_width = 120
1+
column_width = 140
22
line_endings = "Unix"
33
indent_type = "Spaces"
44
indent_width = 2

lua/nvim-tree.lua

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,7 @@ local function setup_autocommands(opts)
218218
create_nvim_tree_autocmd("BufReadPost", {
219219
callback = function(data)
220220
-- update opened file buffers
221-
if
222-
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
223-
and vim.bo[data.buf].buftype == ""
224-
then
221+
if (filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none") and vim.bo[data.buf].buftype == "" then
225222
utils.debounce("Buf:filter_buffer", opts.view.debounce_delay, function()
226223
reloaders.reload_explorer()
227224
end)
@@ -232,10 +229,7 @@ local function setup_autocommands(opts)
232229
create_nvim_tree_autocmd("BufUnload", {
233230
callback = function(data)
234231
-- update opened file buffers
235-
if
236-
(filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none")
237-
and vim.bo[data.buf].buftype == ""
238-
then
232+
if (filters.config.filter_no_buffer or renderer.config.highlight_opened_files ~= "none") and vim.bo[data.buf].buftype == "" then
239233
utils.debounce("Buf:filter_buffer", opts.view.debounce_delay, function()
240234
reloaders.reload_explorer(nil, data.buf)
241235
end)

lua/nvim-tree/actions/fs/rename-file.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ function M.fn(default_modifier)
5252

5353
-- support for only specific modifiers have been implemented
5454
if not ALLOWED_MODIFIERS[modifier] then
55-
return notify.warn(
56-
"Modifier " .. vim.inspect(modifier) .. " is not in allowed list : " .. table.concat(ALLOWED_MODIFIERS, ",")
57-
)
55+
return notify.warn("Modifier " .. vim.inspect(modifier) .. " is not in allowed list : " .. table.concat(ALLOWED_MODIFIERS, ","))
5856
end
5957

6058
node = lib.get_last_group_node(node)

lua/nvim-tree/actions/node/open-file.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,7 @@ local function pick_win_id()
6262
end
6363

6464
if #M.window_picker.chars < #selectable then
65-
notify.error(
66-
string.format(
67-
"More windows (%d) than actions.open_file.window_picker.chars (%d) - please add more.",
68-
#selectable,
69-
#M.window_picker.chars
70-
)
71-
)
65+
notify.error(string.format("More windows (%d) than actions.open_file.window_picker.chars (%d).", #selectable, #M.window_picker.chars))
7266
return nil
7367
end
7468

lua/nvim-tree/actions/node/system-open.lua

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ function M.fn(node)
1616
stderr = vim.loop.new_pipe(false),
1717
}
1818
table.insert(process.args, node.link_to or node.absolute_path)
19-
process.handle, process.pid = vim.loop.spawn(
20-
process.cmd,
21-
{ args = process.args, stdio = { nil, nil, process.stderr }, detached = true },
22-
function(code)
23-
process.stderr:read_stop()
24-
process.stderr:close()
25-
process.handle:close()
26-
if code ~= 0 then
27-
notify.warn(string.format("system_open failed with return code %d: %s", code, process.errors))
28-
end
19+
20+
local opts = { args = process.args, stdio = { nil, nil, process.stderr }, detached = true }
21+
22+
process.handle, process.pid = vim.loop.spawn(process.cmd, opts, function(code)
23+
process.stderr:read_stop()
24+
process.stderr:close()
25+
process.handle:close()
26+
if code ~= 0 then
27+
notify.warn(string.format("system_open failed with return code %d: %s", code, process.errors))
2928
end
30-
)
29+
end)
30+
3131
table.remove(process.args)
3232
if not process.handle then
3333
notify.warn(string.format("system_open failed to spawn command '%s': %s", process.cmd, process.pid))

lua/nvim-tree/actions/tree-modifiers/expand-all.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ local function gen_iterator()
4747
end
4848
end)
4949
:recursor(function(node)
50-
return expansion_count < M.MAX_FOLDER_DISCOVERY
51-
and (node.group_next and { node.group_next } or (node.open and node.nodes))
50+
return expansion_count < M.MAX_FOLDER_DISCOVERY and (node.group_next and { node.group_next } or (node.open and node.nodes))
5251
end)
5352
:iterate()
5453

lua/nvim-tree/diagnostics.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,9 @@ function M.update()
9595
for line, node in pairs(nodes_by_line) do
9696
local nodepath = utils.canonical_path(node.absolute_path)
9797
log.line("diagnostics", " %d checking nodepath '%s'", line, nodepath)
98-
if
99-
M.show_on_dirs
100-
and vim.startswith(bufpath:gsub("\\", "/"), nodepath:gsub("\\", "/") .. "/")
101-
and (not node.open or M.show_on_open_dirs)
102-
then
98+
99+
local node_contains_buf = vim.startswith(bufpath:gsub("\\", "/"), nodepath:gsub("\\", "/") .. "/")
100+
if M.show_on_dirs and node_contains_buf and (not node.open or M.show_on_open_dirs) then
103101
log.line("diagnostics", " matched fold node '%s'", node.absolute_path)
104102
node.diag_status = severity
105103
elseif nodepath == bufpath then

lua/nvim-tree/explorer/explore.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@ local function populate_children(handle, cwd, node, git_status)
3030
local profile = log.profile_start("explore populate_children %s", abs)
3131

3232
t = get_type_from(t, abs)
33-
if
34-
not filters.should_filter(abs, filter_status)
35-
and not nodes_by_path[abs]
36-
and Watcher.is_fs_event_capable(abs)
37-
then
33+
if not filters.should_filter(abs, filter_status) and not nodes_by_path[abs] and Watcher.is_fs_event_capable(abs) then
3834
local child = nil
3935
if t == "directory" and vim.loop.fs_access(abs, "R") then
4036
child = builders.folder(node, abs, name)

lua/nvim-tree/explorer/filters.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,7 @@ function M.should_filter(path, status)
121121
return false
122122
end
123123

124-
return git(path, status.git_status)
125-
or buf(path, status.bufinfo, status.unloaded_bufnr)
126-
or dotfile(path)
127-
or custom(path)
124+
return git(path, status.git_status) or buf(path, status.bufinfo, status.unloaded_bufnr) or dotfile(path) or custom(path)
128125
end
129126

130127
function M.setup(opts)

lua/nvim-tree/git/runner.lua

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,7 @@ function Runner:_finalise(opts)
156156
log.line("git", "job timed out %s %s", opts.toplevel, opts.path)
157157
timeouts = timeouts + 1
158158
if timeouts == MAX_TIMEOUTS then
159-
notify.warn(
160-
string.format(
161-
"%d git jobs have timed out after %dms, disabling git integration. Try increasing git.timeout",
162-
timeouts,
163-
opts.timeout
164-
)
165-
)
159+
notify.warn(string.format("%d git jobs have timed out after git.timeout %dms, disabling git integration.", timeouts, opts.timeout))
166160
require("nvim-tree.git").disable_git_integration()
167161
end
168162
elseif self.rc ~= 0 then

lua/nvim-tree/help.lua

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ local function compute()
109109

110110
-- header, not padded
111111
local hl = { { "NvimTreeRootFolder", 0, 0, #head_lhs } }
112-
local lines =
113-
{ ("%s%s%s"):format(head_lhs, string.rep(" ", max_desc + max_lhs - #head_lhs - #head_rhs + 2), head_rhs) }
112+
local lines = { ("%s%s%s"):format(head_lhs, string.rep(" ", max_desc + max_lhs - #head_lhs - #head_rhs + 2), head_rhs) }
114113
local width = #lines[1]
115114

116115
-- mappings, left padded 1
@@ -177,12 +176,7 @@ local function open()
177176
vim.wo[M.winnr].cursorline = M.config.cursorline
178177

179178
-- quit binding
180-
vim.keymap.set(
181-
"n",
182-
"q",
183-
close,
184-
{ desc = "nvim-tree: exit help", buffer = M.bufnr, noremap = true, silent = true, nowait = true }
185-
)
179+
vim.keymap.set("n", "q", close, { desc = "nvim-tree: exit help", buffer = M.bufnr, noremap = true, silent = true, nowait = true })
186180

187181
-- close window and delete buffer on leave
188182
vim.api.nvim_create_autocmd({ "BufLeave", "WinLeave" }, {

lua/nvim-tree/legacy.lua

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,7 @@ local function refactored(opts)
4040
utils.move_missing_val(opts, "git", "ignore", opts, "filters", "git_ignored", true)
4141

4242
-- 2023/08/26
43-
utils.move_missing_val(
44-
opts,
45-
"renderer.icons",
46-
"webdev_colors",
47-
opts,
48-
"renderer.icons.web_devicons.file",
49-
"color",
50-
true
51-
)
43+
utils.move_missing_val(opts, "renderer.icons", "webdev_colors", opts, "renderer.icons.web_devicons.file", "color", true)
5244
end
5345

5446
local function deprecated(opts)

lua/nvim-tree/notify.lua

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,12 @@ local config = {
77

88
local title_support
99
function M.supports_title()
10-
-- TODO increase stylua column_width
11-
-- stylua: ignore start
1210
if title_support == nil then
1311
title_support = (package.loaded.notify and (vim.notify == require "notify" or vim.notify == require("notify").notify))
1412
or (package.loaded.noice and (vim.notify == require("noice").notify or vim.notify == require("noice.source.notify").notify))
1513
or (package.loaded.notifier and require("notifier.config").has_component "nvim")
1614
or false
1715
end
18-
-- stylua: ignore end
1916

2017
return title_support
2118
end

lua/nvim-tree/renderer/builder.lua

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ function Builder:_build_folder(node)
168168
local link_to = utils.path_relative(node.link_to, core.get_cwd())
169169
foldername = foldername .. arrow .. link_to
170170
foldername_hl = "NvimTreeSymlinkFolderName"
171-
elseif
172-
vim.tbl_contains(self.special_files, node.absolute_path) or vim.tbl_contains(self.special_files, node.name)
173-
then
171+
elseif vim.tbl_contains(self.special_files, node.absolute_path) or vim.tbl_contains(self.special_files, node.name) then
174172
foldername_hl = "NvimTreeSpecialFolderName"
175173
elseif node.open then
176174
foldername_hl = "NvimTreeOpenedFolderName"
@@ -278,11 +276,7 @@ function Builder:_get_highlight_override(node, unloaded_bufnr)
278276
end
279277

280278
-- opened file
281-
if
282-
self.highlight_opened_files
283-
and vim.fn.bufloaded(node.absolute_path) > 0
284-
and vim.fn.bufnr(node.absolute_path) ~= unloaded_bufnr
285-
then
279+
if self.highlight_opened_files and vim.fn.bufloaded(node.absolute_path) > 0 and vim.fn.bufnr(node.absolute_path) ~= unloaded_bufnr then
286280
if self.highlight_opened_files == "all" or self.highlight_opened_files == "name" then
287281
name_hl = "NvimTreeOpenedFile"
288282
end
@@ -331,16 +325,7 @@ end
331325
---@param modified_icon HighlightedString|nil
332326
---@param bookmark_icon HighlightedString|nil
333327
---@return HighlightedString[]
334-
function Builder:_format_line(
335-
indent_markers,
336-
arrows,
337-
icon,
338-
name,
339-
git_icons,
340-
diagnostics_icon,
341-
modified_icon,
342-
bookmark_icon
343-
)
328+
function Builder:_format_line(indent_markers, arrows, icon, name, git_icons, diagnostics_icon, modified_icon, bookmark_icon)
344329
local added_len = 0
345330
local function add_to_end(t1, t2)
346331
for _, v in ipairs(t2) do
@@ -430,8 +415,7 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
430415
self:_append_highlight(node, diagnostics.get_highlight, icon.hl, name.hl)
431416
self:_append_highlight(node, copy_paste.get_highlight, icon.hl, name.hl)
432417

433-
local line =
434-
self:_format_line(indent_markers, arrows, icon, name, git_icons, diagnostics_icon, modified_icon, bookmark_icon)
418+
local line = self:_format_line(indent_markers, arrows, icon, name, git_icons, diagnostics_icon, modified_icon, bookmark_icon)
435419
self:_insert_line(self:_unwrap_highlighted_strings(line))
436420

437421
self.index = self.index + 1

lua/nvim-tree/renderer/components/git.lua

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,7 @@ end
9494
local function nil_() end
9595

9696
local function warn_status(git_status)
97-
notify.warn(
98-
'Unrecognized git state "'
99-
.. git_status
100-
.. '". Please open up an issue on https://github.com/nvim-tree/nvim-tree.lua/issues with this message.'
101-
)
97+
notify.warn(string.format("Unrecognized git state '%s'", git_status))
10298
end
10399

104100
---@param node table

lua/nvim-tree/renderer/components/padding.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ local function get_padding_indent_markers(depth, idx, nodes_number, markers, wit
3030
for i = 1, depth do
3131
local glyph
3232
if idx == nodes_number and i == depth then
33-
local bottom_width = M.config.indent_width
34-
- 2
35-
+ (with_arrows and not inline_arrows and has_folder_sibling and 2 or 0)
33+
local bottom_width = M.config.indent_width - 2 + (with_arrows and not inline_arrows and has_folder_sibling and 2 or 0)
3634
glyph = M.config.indent_markers.icons.corner
3735
.. string.rep(M.config.indent_markers.icons.bottom, bottom_width)
3836
.. (M.config.indent_width > 1 and " " or "")

lua/nvim-tree/utils.lua

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ function M.rename_loaded_buffers(old_path, new_path)
176176
if vim.api.nvim_buf_is_loaded(buf) then
177177
local buf_name = vim.api.nvim_buf_get_name(buf)
178178
local exact_match = buf_name == old_path
179-
local child_match = (
180-
buf_name:sub(1, #old_path) == old_path and buf_name:sub(#old_path + 1, #old_path + 1) == path_separator
181-
)
179+
local child_match = (buf_name:sub(1, #old_path) == old_path and buf_name:sub(#old_path + 1, #old_path + 1) == path_separator)
182180
if exact_match or child_match then
183181
vim.api.nvim_buf_set_name(buf, new_path .. buf_name:sub(#old_path + 1))
184182
-- to avoid the 'overwrite existing file' error message on write for

lua/nvim-tree/watcher.lua

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,10 @@ function Event:start()
7373

7474
rc, _, name = self._fs_event:start(self._path, FS_EVENT_FLAGS, event_cb)
7575
if rc ~= 0 then
76-
local warning = string.format("Could not start the fs_event watcher for path %s : %s", self._path, name)
7776
if name == "EMFILE" then
78-
M.disable_watchers(
79-
warning,
80-
"Please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Troubleshooting#could-not-start-fs_event-for-path--emfile"
81-
)
77+
M.disable_watchers "fs.inotify.max_user_watches exceeded, see https://github.com/nvim-tree/nvim-tree.lua/wiki/Troubleshooting"
8278
else
83-
notify.warn(warning)
79+
notify.warn(string.format("Could not start the fs_event watcher for path %s : %s", self._path, name))
8480
end
8581
return false
8682
end
@@ -164,10 +160,9 @@ end
164160
M.Watcher = Watcher
165161

166162
--- Permanently disable watchers and purge all state following a catastrophic error.
167-
--- @param warning string
168-
--- @param detail string
169-
function M.disable_watchers(warning, detail)
170-
notify.warn(string.format("%s Disabling watchers: %s", warning, detail))
163+
--- @param msg string
164+
function M.disable_watchers(msg)
165+
notify.warn(string.format("Disabling watchers: %s", msg))
171166
M.config.filesystem_watchers.enable = false
172167
require("nvim-tree").purge_all_state()
173168
end

0 commit comments

Comments
 (0)