chore: stylua column width 120 -> 140, tidy
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
column_width = 140
|
column_width = 160
|
||||||
line_endings = "Unix"
|
line_endings = "Unix"
|
||||||
indent_type = "Spaces"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
|
|||||||
@@ -62,13 +62,7 @@ local function pick_win_id()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if #M.window_picker.chars < #selectable then
|
if #M.window_picker.chars < #selectable then
|
||||||
notify.error(
|
notify.error(string.format("More windows (%d) than actions.open_file.window_picker.chars (%d) - please add more.", #selectable, #M.window_picker.chars))
|
||||||
string.format(
|
|
||||||
"More windows (%d) than actions.open_file.window_picker.chars (%d) - please add more.",
|
|
||||||
#selectable,
|
|
||||||
#M.window_picker.chars
|
|
||||||
)
|
|
||||||
)
|
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -16,18 +16,14 @@ function M.fn(node)
|
|||||||
stderr = vim.loop.new_pipe(false),
|
stderr = vim.loop.new_pipe(false),
|
||||||
}
|
}
|
||||||
table.insert(process.args, node.link_to or node.absolute_path)
|
table.insert(process.args, node.link_to or node.absolute_path)
|
||||||
process.handle, process.pid = vim.loop.spawn(
|
process.handle, process.pid = vim.loop.spawn(process.cmd, { args = process.args, stdio = { nil, nil, process.stderr }, detached = true }, function(code)
|
||||||
process.cmd,
|
|
||||||
{ args = process.args, stdio = { nil, nil, process.stderr }, detached = true },
|
|
||||||
function(code)
|
|
||||||
process.stderr:read_stop()
|
process.stderr:read_stop()
|
||||||
process.stderr:close()
|
process.stderr:close()
|
||||||
process.handle:close()
|
process.handle:close()
|
||||||
if code ~= 0 then
|
if code ~= 0 then
|
||||||
notify.warn(string.format("system_open failed with return code %d: %s", code, process.errors))
|
notify.warn(string.format("system_open failed with return code %d: %s", code, process.errors))
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
)
|
|
||||||
table.remove(process.args)
|
table.remove(process.args)
|
||||||
if not process.handle then
|
if not process.handle then
|
||||||
notify.warn(string.format("system_open failed to spawn command '%s': %s", process.cmd, process.pid))
|
notify.warn(string.format("system_open failed to spawn command '%s': %s", process.cmd, process.pid))
|
||||||
|
|||||||
@@ -95,11 +95,7 @@ function M.update()
|
|||||||
for line, node in pairs(nodes_by_line) do
|
for line, node in pairs(nodes_by_line) do
|
||||||
local nodepath = utils.canonical_path(node.absolute_path)
|
local nodepath = utils.canonical_path(node.absolute_path)
|
||||||
log.line("diagnostics", " %d checking nodepath '%s'", line, nodepath)
|
log.line("diagnostics", " %d checking nodepath '%s'", line, nodepath)
|
||||||
if
|
if M.show_on_dirs and vim.startswith(bufpath:gsub("\\", "/"), nodepath:gsub("\\", "/") .. "/") and (not node.open or M.show_on_open_dirs) then
|
||||||
M.show_on_dirs
|
|
||||||
and vim.startswith(bufpath:gsub("\\", "/"), nodepath:gsub("\\", "/") .. "/")
|
|
||||||
and (not node.open or M.show_on_open_dirs)
|
|
||||||
then
|
|
||||||
log.line("diagnostics", " matched fold node '%s'", node.absolute_path)
|
log.line("diagnostics", " matched fold node '%s'", node.absolute_path)
|
||||||
node.diag_status = severity
|
node.diag_status = severity
|
||||||
elseif nodepath == bufpath then
|
elseif nodepath == bufpath then
|
||||||
|
|||||||
@@ -156,13 +156,7 @@ function Runner:_finalise(opts)
|
|||||||
log.line("git", "job timed out %s %s", opts.toplevel, opts.path)
|
log.line("git", "job timed out %s %s", opts.toplevel, opts.path)
|
||||||
timeouts = timeouts + 1
|
timeouts = timeouts + 1
|
||||||
if timeouts == MAX_TIMEOUTS then
|
if timeouts == MAX_TIMEOUTS then
|
||||||
notify.warn(
|
notify.warn(string.format("%d git jobs have timed out after %dms, disabling git integration. Try increasing git.timeout", timeouts, opts.timeout))
|
||||||
string.format(
|
|
||||||
"%d git jobs have timed out after %dms, disabling git integration. Try increasing git.timeout",
|
|
||||||
timeouts,
|
|
||||||
opts.timeout
|
|
||||||
)
|
|
||||||
)
|
|
||||||
require("nvim-tree.git").disable_git_integration()
|
require("nvim-tree.git").disable_git_integration()
|
||||||
end
|
end
|
||||||
elseif self.rc ~= 0 then
|
elseif self.rc ~= 0 then
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ end
|
|||||||
---@param node table
|
---@param node table
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function M.is_modified(node)
|
function M.is_modified(node)
|
||||||
return M.config.enable
|
return M.config.enable and M._record[node.absolute_path] and (not node.nodes or M.config.show_on_dirs) and (not node.open or M.config.show_on_open_dirs)
|
||||||
and M._record[node.absolute_path]
|
|
||||||
and (not node.nodes or M.config.show_on_dirs)
|
|
||||||
and (not node.open or M.config.show_on_open_dirs)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param opts table
|
---@param opts table
|
||||||
|
|||||||
@@ -94,11 +94,7 @@ end
|
|||||||
local function nil_() end
|
local function nil_() end
|
||||||
|
|
||||||
local function warn_status(git_status)
|
local function warn_status(git_status)
|
||||||
notify.warn(
|
notify.warn('Unrecognized git state "' .. git_status .. '". Please open up an issue on https://github.com/nvim-tree/nvim-tree.lua/issues with this message.')
|
||||||
'Unrecognized git state "'
|
|
||||||
.. git_status
|
|
||||||
.. '". Please open up an issue on https://github.com/nvim-tree/nvim-tree.lua/issues with this message.'
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param node table
|
---@param node table
|
||||||
|
|||||||
@@ -73,14 +73,10 @@ function Event:start()
|
|||||||
|
|
||||||
rc, _, name = self._fs_event:start(self._path, FS_EVENT_FLAGS, event_cb)
|
rc, _, name = self._fs_event:start(self._path, FS_EVENT_FLAGS, event_cb)
|
||||||
if rc ~= 0 then
|
if rc ~= 0 then
|
||||||
local warning = string.format("Could not start the fs_event watcher for path %s : %s", self._path, name)
|
|
||||||
if name == "EMFILE" then
|
if name == "EMFILE" then
|
||||||
M.disable_watchers(
|
M.disable_watchers "fs.inotify.max_user_watches exceeded, see https://github.com/nvim-tree/nvim-tree.lua/wiki/Troubleshooting"
|
||||||
warning,
|
|
||||||
"Please see https://github.com/nvim-tree/nvim-tree.lua/wiki/Troubleshooting#could-not-start-fs_event-for-path--emfile"
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
notify.warn(warning)
|
notify.warn(string.format("Could not start the fs_event watcher for path %s : %s", self._path, name))
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
@@ -164,10 +160,9 @@ end
|
|||||||
M.Watcher = Watcher
|
M.Watcher = Watcher
|
||||||
|
|
||||||
--- Permanently disable watchers and purge all state following a catastrophic error.
|
--- Permanently disable watchers and purge all state following a catastrophic error.
|
||||||
--- @param warning string
|
--- @param msg string
|
||||||
--- @param detail string
|
function M.disable_watchers(msg)
|
||||||
function M.disable_watchers(warning, detail)
|
notify.warn(string.format("Disabling watchers: %s", msg))
|
||||||
notify.warn(string.format("%s Disabling watchers: %s", warning, detail))
|
|
||||||
M.config.filesystem_watchers.enable = false
|
M.config.filesystem_watchers.enable = false
|
||||||
require("nvim-tree").purge_all_state()
|
require("nvim-tree").purge_all_state()
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user