chore(#2931): stylua -> EmmyLuaCodeStyle (#2932)

* stylua -> EmmyLuaCodeStyle: config and doc

* stylua -> EmmyLuaCodeStyle: CI

* stylua -> EmmyLuaCodeStyle: CI

* stylua -> EmmyLuaCodeStyle: CI

* stylua -> EmmyLuaCodeStyle: CI

* stylua -> EmmyLuaCodeStyle: CI

* stylua -> EmmyLuaCodeStyle

* stylua -> EmmyLuaCodeStyle: call_arg_parentheses = always

* stylua -> EmmyLuaCodeStyle

* stylua -> EmmyLuaCodeStyle
This commit is contained in:
Alexander Courtis
2024-09-29 14:05:52 +10:00
committed by GitHub
parent 9650e735ba
commit 1ae1c33ce1
80 changed files with 590 additions and 583 deletions

View File

@@ -1,10 +1,10 @@
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"
local git_utils = require "nvim-tree.git.utils"
local Runner = require "nvim-tree.git.runner"
local log = require("nvim-tree.log")
local utils = require("nvim-tree.utils")
local git_utils = require("nvim-tree.git.utils")
local Runner = require("nvim-tree.git.runner")
local Watcher = require("nvim-tree.watcher").Watcher
local Iterator = require "nvim-tree.iterators.node-iterator"
local explorer_node = require "nvim-tree.explorer.node"
local Iterator = require("nvim-tree.iterators.node-iterator")
local explorer_node = require("nvim-tree.explorer.node")
local M = {
config = {},
@@ -23,10 +23,10 @@ local M = {
-- Utilities (like watchman) can also write to this directory (often) and aren't useful for us.
local WATCHED_FILES = {
"FETCH_HEAD", -- remote ref
"HEAD", -- local ref
"HEAD.lock", -- HEAD will not always be updated e.g. revert
"config", -- user config
"index", -- staging area
"HEAD", -- local ref
"HEAD.lock", -- HEAD will not always be updated e.g. revert
"config", -- user config
"index", -- staging area
}
---@param toplevel string|nil
@@ -243,12 +243,12 @@ function M.load_project_status(path)
return status
end
local git_status = Runner.run {
local git_status = Runner.run({
toplevel = toplevel,
list_untracked = git_utils.should_show_untracked(toplevel),
list_ignored = true,
timeout = M.config.git.timeout,
}
})
local watcher = nil
if M.config.filesystem_watchers.enable then
@@ -264,7 +264,7 @@ function M.load_project_status(path)
end)
end
local git_dir = vim.env.GIT_DIR or M._git_dirs_by_toplevel[toplevel] or utils.path_join { toplevel, ".git" }
local git_dir = vim.env.GIT_DIR or M._git_dirs_by_toplevel[toplevel] or utils.path_join({ toplevel, ".git" })
watcher = Watcher:new(git_dir, WATCHED_FILES, callback, {
toplevel = toplevel,
})

View File

@@ -1,6 +1,6 @@
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"
local notify = require "nvim-tree.notify"
local log = require("nvim-tree.log")
local utils = require("nvim-tree.utils")
local notify = require("nvim-tree.notify")
---@class Runner
local Runner = {}
@@ -18,11 +18,11 @@ function Runner:_parse_status_output(status, path)
end
-- replacing slashes if on windows
if vim.fn.has "win32" == 1 then
if vim.fn.has("win32") == 1 then
path = path:gsub("/", "\\")
end
if #status > 0 and #path > 0 then
self.output[utils.path_remove_trailing(utils.path_join { self.toplevel, path })] = status
self.output[utils.path_remove_trailing(utils.path_join({ self.toplevel, path }))] = status
end
end
@@ -35,7 +35,7 @@ function Runner:_handle_incoming_data(prev_output, incoming)
local prev = prev_output .. incoming
local i = 1
local skip_next_line = false
for line in prev:gmatch "[^\n]*\n" do
for line in prev:gmatch("[^\n]*\n") do
if skip_next_line then
skip_next_line = false
else
@@ -57,7 +57,7 @@ function Runner:_handle_incoming_data(prev_output, incoming)
return prev_output .. incoming
end
for line in prev_output:gmatch "[^\n]*\n" do
for line in prev_output:gmatch("[^\n]*\n") do
self:_parse_status_output(line)
end
@@ -79,7 +79,7 @@ end
---@param output string
function Runner:_log_raw_output(output)
if log.enabled "git" and output and type(output) == "string" then
if log.enabled("git") and output and type(output) == "string" then
log.raw("git", "%s", output)
log.line("git", "done")
end

View File

@@ -1,5 +1,5 @@
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"
local log = require("nvim-tree.log")
local utils = require("nvim-tree.utils")
local M = {
use_cygpath = false,
@@ -21,30 +21,30 @@ function M.get_toplevel(cwd)
log.raw("git", out)
log.profile_end(profile)
if vim.v.shell_error ~= 0 or not out or #out == 0 or out:match "fatal" then
if vim.v.shell_error ~= 0 or not out or #out == 0 or out:match("fatal") then
return nil, nil
end
local toplevel, git_dir = out:match "([^\n]+)\n+([^\n]+)"
local toplevel, git_dir = out:match("([^\n]+)\n+([^\n]+)")
if not toplevel then
return nil, nil
end
if not git_dir then
git_dir = utils.path_join { toplevel, ".git" }
git_dir = utils.path_join({ toplevel, ".git" })
end
-- git always returns path with forward slashes
if vim.fn.has "win32" == 1 then
if vim.fn.has("win32") == 1 then
-- msys2 git support
-- cygpath calls must in array format to avoid shell compatibility issues
if M.use_cygpath then
toplevel = vim.fn.system { "cygpath", "-w", toplevel }
toplevel = vim.fn.system({ "cygpath", "-w", toplevel })
if vim.v.shell_error ~= 0 then
return nil, nil
end
-- remove trailing newline(\n) character added by vim.fn.system
toplevel = toplevel:gsub("\n", "")
git_dir = vim.fn.system { "cygpath", "-w", git_dir }
git_dir = vim.fn.system({ "cygpath", "-w", git_dir })
if vim.v.shell_error ~= 0 then
return nil, nil
end
@@ -128,7 +128,7 @@ end
function M.setup(opts)
if opts.git.cygwin_support then
M.use_cygpath = vim.fn.executable "cygpath" == 1
M.use_cygpath = vim.fn.executable("cygpath") == 1
end
end