Skip to content

Commit

Permalink
stylua -> EmmyLuaCodeStyle: call_arg_parentheses = always
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-courtis committed Sep 29, 2024
1 parent b9c2c09 commit a6774c6
Show file tree
Hide file tree
Showing 73 changed files with 450 additions and 448 deletions.
36 changes: 18 additions & 18 deletions lua/nvim-tree.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
local lib = require "nvim-tree.lib"
local log = require "nvim-tree.log"
local appearance = require "nvim-tree.appearance"
local view = require "nvim-tree.view"
local utils = require "nvim-tree.utils"
local actions = require "nvim-tree.actions"
local core = require "nvim-tree.core"
local notify = require "nvim-tree.notify"
local lib = require("nvim-tree.lib")
local log = require("nvim-tree.log")
local appearance = require("nvim-tree.appearance")
local view = require("nvim-tree.view")
local utils = require("nvim-tree.utils")
local actions = require("nvim-tree.actions")
local core = require("nvim-tree.core")
local notify = require("nvim-tree.notify")

local _config = {}

Expand All @@ -21,7 +21,7 @@ function M.change_root(path, bufnr)
if type(bufnr) == "number" then
local ft

if vim.fn.has "nvim-0.10" == 1 then
if vim.fn.has("nvim-0.10") == 1 then
ft = vim.api.nvim_get_option_value("filetype", { buf = bufnr }) or ""
else
ft = vim.api.nvim_buf_get_option(bufnr, "filetype") or "" ---@diagnostic disable-line: deprecated
Expand Down Expand Up @@ -76,11 +76,11 @@ function M.change_root(path, bufnr)
end

function M.tab_enter()
if view.is_visible { any_tabpage = true } then
if view.is_visible({ any_tabpage = true }) then
local bufname = vim.api.nvim_buf_get_name(0)

local ft
if vim.fn.has "nvim-0.10" == 1 then
if vim.fn.has("nvim-0.10") == 1 then
ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) or ""
else
ft = vim.api.nvim_buf_get_option(0, "ft") ---@diagnostic disable-line: deprecated
Expand All @@ -91,7 +91,7 @@ function M.tab_enter()
return
end
end
view.open { focus_tree = false }
view.open({ focus_tree = false })

local explorer = core.get_explorer()
if explorer then
Expand Down Expand Up @@ -145,8 +145,8 @@ end
---@param hijack_netrw boolean
local function manage_netrw(disable_netrw, hijack_netrw)
if hijack_netrw then
vim.cmd "silent! autocmd! FileExplorer *"
vim.cmd "autocmd VimEnter * ++once silent! autocmd! FileExplorer *"
vim.cmd("silent! autocmd! FileExplorer *")
vim.cmd("autocmd VimEnter * ++once silent! autocmd! FileExplorer *")
end
if disable_netrw then
vim.g.loaded_netrw = 1
Expand Down Expand Up @@ -316,7 +316,7 @@ local function setup_autocommands(opts)
callback = function()
vim.schedule(function()
vim.api.nvim_buf_call(0, function()
vim.cmd [[norm! zz]]
vim.cmd([[norm! zz]])
end)
end)
end,
Expand Down Expand Up @@ -811,8 +811,8 @@ end

---@param conf table|nil
function M.setup(conf)
if vim.fn.has "nvim-0.9" == 0 then
notify.warn "nvim-tree.lua requires Neovim 0.9 or higher"
if vim.fn.has("nvim-0.9") == 0 then
notify.warn("nvim-tree.lua requires Neovim 0.9 or higher")
return
end

Expand Down Expand Up @@ -840,7 +840,7 @@ function M.setup(conf)
require("nvim-tree.notify").setup(opts)
require("nvim-tree.log").setup(opts)

if log.enabled "config" then
if log.enabled("config") then
log.line("config", "default config + user")
log.raw("config", "%s\n", vim.inspect(opts))
end
Expand Down
12 changes: 6 additions & 6 deletions lua/nvim-tree/actions/finders/find-file.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local log = require "nvim-tree.log"
local view = require "nvim-tree.view"
local utils = require "nvim-tree.utils"
local core = require "nvim-tree.core"
local Iterator = require "nvim-tree.iterators.node-iterator"
local log = require("nvim-tree.log")
local view = require("nvim-tree.view")
local utils = require("nvim-tree.utils")
local core = require("nvim-tree.core")
local Iterator = require("nvim-tree.iterators.node-iterator")

local M = {}

Expand Down Expand Up @@ -76,7 +76,7 @@ function M.fn(path)

if found and view.is_visible() then
explorer.renderer:draw()
view.set_cursor { line, 0 }
view.set_cursor({ line, 0 })
end

running[path_real] = false
Expand Down
4 changes: 2 additions & 2 deletions lua/nvim-tree/actions/finders/init.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local M = {}

M.find_file = require "nvim-tree.actions.finders.find-file"
M.search_node = require "nvim-tree.actions.finders.search-node"
M.find_file = require("nvim-tree.actions.finders.find-file")
M.search_node = require("nvim-tree.actions.finders.search-node")

return M
8 changes: 4 additions & 4 deletions lua/nvim-tree/actions/finders/search-node.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local core = require "nvim-tree.core"
local core = require("nvim-tree.core")
local find_file = require("nvim-tree.actions.finders.find-file").fn

local M = {}
Expand Down Expand Up @@ -75,7 +75,7 @@ function M.fn()
local bufnr = vim.api.nvim_get_current_buf()

local path_existed, path_opt
if vim.fn.has "nvim-0.10" == 1 then
if vim.fn.has("nvim-0.10") == 1 then
path_existed, path_opt = pcall(vim.api.nvim_get_option_value, "path", { buf = bufnr })
vim.api.nvim_set_option_value("path", core.get_cwd() .. "/**", { buf = bufnr })
else
Expand All @@ -89,13 +89,13 @@ function M.fn()
end
-- reset &path
if path_existed then
if vim.fn.has "nvim-0.10" == 1 then
if vim.fn.has("nvim-0.10") == 1 then
vim.api.nvim_set_option_value("path", path_opt, { buf = bufnr })
else
vim.api.nvim_buf_set_option(bufnr, "path", path_opt) ---@diagnostic disable-line: deprecated
end
else
if vim.fn.has "nvim-0.10" == 1 then
if vim.fn.has("nvim-0.10") == 1 then
vim.api.nvim_set_option_value("path", nil, { buf = bufnr })
else
vim.api.nvim_buf_set_option(bufnr, "path", nil) ---@diagnostic disable-line: deprecated
Expand Down
22 changes: 11 additions & 11 deletions lua/nvim-tree/actions/fs/clipboard.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local lib = require "nvim-tree.lib"
local log = require "nvim-tree.log"
local utils = require "nvim-tree.utils"
local core = require "nvim-tree.core"
local events = require "nvim-tree.events"
local notify = require "nvim-tree.notify"
local lib = require("nvim-tree.lib")
local log = require("nvim-tree.log")
local utils = require("nvim-tree.utils")
local core = require("nvim-tree.core")
local events = require("nvim-tree.events")
local notify = require("nvim-tree.notify")

local find_file = require("nvim-tree.actions.finders.find-file").fn

Expand Down Expand Up @@ -89,8 +89,8 @@ local function do_copy(source, destination)
break
end

local new_name = utils.path_join { source, name }
local new_destination = utils.path_join { destination, name }
local new_name = utils.path_join({ source, name })
local new_destination = utils.path_join({ destination, name })
success, errmsg = do_copy(new_name, new_destination)
if not success then
return false, errmsg
Expand Down Expand Up @@ -191,7 +191,7 @@ end
function Clipboard:clear_clipboard()
self.data[ACTION.copy] = {}
self.data[ACTION.cut] = {}
notify.info "Clipboard has been emptied."
notify.info("Clipboard has been emptied.")
self.explorer.renderer:draw()
end

Expand Down Expand Up @@ -240,7 +240,7 @@ function Clipboard:do_paste(node, action, action_fn)
end

for _, _node in ipairs(clip) do
local dest = utils.path_join { destination, _node.name }
local dest = utils.path_join({ destination, _node.name })
do_single_paste(_node.absolute_path, dest, action, action_fn)
end

Expand Down Expand Up @@ -361,7 +361,7 @@ function Clipboard:copy_path(node)

if node.name == ".." then
-- root
content = utils.path_add_trailing ""
content = utils.path_add_trailing("")
else
-- node
local absolute_path = node.absolute_path
Expand Down
18 changes: 9 additions & 9 deletions lua/nvim-tree/actions/fs/create-file.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local lib = require "nvim-tree.lib"
local core = require "nvim-tree.core"
local notify = require "nvim-tree.notify"
local utils = require("nvim-tree.utils")
local events = require("nvim-tree.events")
local lib = require("nvim-tree.lib")
local core = require("nvim-tree.core")
local notify = require("nvim-tree.notify")

local find_file = require("nvim-tree.actions.finders.find-file").fn

Expand Down Expand Up @@ -72,7 +72,7 @@ function M.fn(node)
end

if utils.file_exists(new_file_path) then
notify.warn "Cannot create: file already exists"
notify.warn("Cannot create: file already exists")
return
end

Expand All @@ -87,10 +87,10 @@ function M.fn(node)
for path in utils.path_split(new_file_path) do
idx = idx + 1
local p = utils.path_remove_trailing(path)
if #path_to_create == 0 and vim.fn.has "win32" == 1 then
path_to_create = utils.path_join { p, path_to_create }
if #path_to_create == 0 and vim.fn.has("win32") == 1 then
path_to_create = utils.path_join({ p, path_to_create })
else
path_to_create = utils.path_join { path_to_create, p }
path_to_create = utils.path_join({ path_to_create, p })
end
if is_last_path_file and idx == num_nodes then
create_and_notify(path_to_create)
Expand Down
8 changes: 4 additions & 4 deletions lua/nvim-tree/actions/fs/init.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local M = {}

M.create_file = require "nvim-tree.actions.fs.create-file"
M.remove_file = require "nvim-tree.actions.fs.remove-file"
M.rename_file = require "nvim-tree.actions.fs.rename-file"
M.trash = require "nvim-tree.actions.fs.trash"
M.create_file = require("nvim-tree.actions.fs.create-file")
M.remove_file = require("nvim-tree.actions.fs.remove-file")
M.rename_file = require("nvim-tree.actions.fs.rename-file")
M.trash = require("nvim-tree.actions.fs.trash")

function M.setup(opts)
M.remove_file.setup(opts)
Expand Down
18 changes: 9 additions & 9 deletions lua/nvim-tree/actions/fs/remove-file.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local core = require "nvim-tree.core"
local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local view = require "nvim-tree.view"
local lib = require "nvim-tree.lib"
local notify = require "nvim-tree.notify"
local core = require("nvim-tree.core")
local utils = require("nvim-tree.utils")
local events = require("nvim-tree.events")
local view = require("nvim-tree.view")
local lib = require("nvim-tree.lib")
local notify = require("nvim-tree.notify")

local M = {
config = {},
Expand All @@ -27,13 +27,13 @@ end

---@param absolute_path string
local function clear_buffer(absolute_path)
local bufs = vim.fn.getbufinfo { bufloaded = 1, buflisted = 1 }
local bufs = vim.fn.getbufinfo({ bufloaded = 1, buflisted = 1 })
for _, buf in pairs(bufs) do
if buf.name == absolute_path then
local tree_winnr = vim.api.nvim_get_current_win()
if buf.hidden == 0 and (#bufs > 1 or view.View.float.enable) then
vim.api.nvim_set_current_win(buf.windows[1])
vim.cmd ":bn"
vim.cmd(":bn")
end
vim.api.nvim_buf_delete(buf.bufnr, { force = true })
if not view.View.float.quit_on_focus_loss then
Expand Down Expand Up @@ -62,7 +62,7 @@ local function remove_dir(cwd)
break
end

local new_cwd = utils.path_join { cwd, name }
local new_cwd = utils.path_join({ cwd, name })

-- Type must come from fs_stat and not fs_scandir_next to maintain sshfs compatibility
local stat = vim.loop.fs_stat(new_cwd)
Expand Down
16 changes: 8 additions & 8 deletions lua/nvim-tree/actions/fs/rename-file.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local core = require "nvim-tree.core"
local lib = require "nvim-tree.lib"
local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local notify = require "nvim-tree.notify"
local core = require("nvim-tree.core")
local lib = require("nvim-tree.lib")
local utils = require("nvim-tree.utils")
local events = require("nvim-tree.events")
local notify = require("nvim-tree.notify")

local find_file = require("nvim-tree.actions.finders.find-file").fn

Expand Down Expand Up @@ -64,10 +64,10 @@ function M.rename(node, to)
idx = idx + 1

local p = utils.path_remove_trailing(path)
if #path_to_create == 0 and vim.fn.has "win32" == 1 then
path_to_create = utils.path_join { p, path_to_create }
if #path_to_create == 0 and vim.fn.has("win32") == 1 then
path_to_create = utils.path_join({ p, path_to_create })
else
path_to_create = utils.path_join { path_to_create, p }
path_to_create = utils.path_join({ path_to_create, p })
end

if idx == num_nodes then
Expand Down
16 changes: 8 additions & 8 deletions lua/nvim-tree/actions/fs/trash.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
local core = require "nvim-tree.core"
local lib = require "nvim-tree.lib"
local notify = require "nvim-tree.notify"
local core = require("nvim-tree.core")
local lib = require("nvim-tree.lib")
local notify = require("nvim-tree.notify")

local M = {
config = {},
}

local utils = require "nvim-tree.utils"
local events = require "nvim-tree.events"
local utils = require("nvim-tree.utils")
local events = require("nvim-tree.events")

---@param absolute_path string
local function clear_buffer(absolute_path)
local bufs = vim.fn.getbufinfo { bufloaded = 1, buflisted = 1 }
local bufs = vim.fn.getbufinfo({ bufloaded = 1, buflisted = 1 })
for _, buf in pairs(bufs) do
if buf.name == absolute_path then
if buf.hidden == 0 and #bufs > 1 then
local winnr = vim.api.nvim_get_current_win()
vim.api.nvim_set_current_win(buf.windows[1])
vim.cmd ":bn"
vim.cmd(":bn")
vim.api.nvim_set_current_win(winnr)
end
vim.api.nvim_buf_delete(buf.bufnr, {})
Expand Down Expand Up @@ -48,7 +48,7 @@ function M.remove(node)
on_stderr = on_stderr,
})
if need_sync_wait then
vim.fn.jobwait { job }
vim.fn.jobwait({ job })
end
end

Expand Down
12 changes: 6 additions & 6 deletions lua/nvim-tree/actions/init.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
local M = {}

M.finders = require "nvim-tree.actions.finders"
M.fs = require "nvim-tree.actions.fs"
M.moves = require "nvim-tree.actions.moves"
M.node = require "nvim-tree.actions.node"
M.root = require "nvim-tree.actions.root"
M.tree = require "nvim-tree.actions.tree"
M.finders = require("nvim-tree.actions.finders")
M.fs = require("nvim-tree.actions.fs")
M.moves = require("nvim-tree.actions.moves")
M.node = require("nvim-tree.actions.node")
M.root = require("nvim-tree.actions.root")
M.tree = require("nvim-tree.actions.tree")

function M.setup(opts)
M.fs.setup(opts)
Expand Down
6 changes: 3 additions & 3 deletions lua/nvim-tree/actions/moves/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local M = {}

M.item = require "nvim-tree.actions.moves.item"
M.parent = require "nvim-tree.actions.moves.parent"
M.sibling = require "nvim-tree.actions.moves.sibling"
M.item = require("nvim-tree.actions.moves.item")
M.parent = require("nvim-tree.actions.moves.parent")
M.sibling = require("nvim-tree.actions.moves.sibling")

return M
Loading

0 comments on commit a6774c6

Please sign in to comment.