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