chore: stylua

This commit is contained in:
hedy
2023-11-18 10:02:04 +08:00
parent 3b4116c2c6
commit 82ab53a167

View File

@@ -84,13 +84,13 @@ local function __refresh()
vim.api.nvim_del_autocmd(M.state.autocmds[M.state.code_win]) vim.api.nvim_del_autocmd(M.state.autocmds[M.state.code_win])
end end
if utils.str_or_nonempty_table(cfg.o.outline_window.auto_update_events.cursor) then if utils.str_or_nonempty_table(cfg.o.outline_window.auto_update_events.cursor) then
M.state.autocmds[M.state.code_win] = vim.api.nvim_create_autocmd( M.state.autocmds[M.state.code_win] =
cfg.o.outline_window.auto_update_events.cursor, vim.api.nvim_create_autocmd(cfg.o.outline_window.auto_update_events.cursor, {
{
buffer = vim.api.nvim_win_get_buf(M.state.code_win), buffer = vim.api.nvim_win_get_buf(M.state.code_win),
callback = function() M._highlight_current_item(nil) end callback = function()
} M._highlight_current_item(nil)
) end,
})
end end
end end
@@ -117,7 +117,7 @@ function M.__goto_location(change_focus)
local node = M._current_node() local node = M._current_node()
vim.api.nvim_win_set_cursor(M.state.code_win, { node.line + 1, node.character }) vim.api.nvim_win_set_cursor(M.state.code_win, { node.line + 1, node.character })
if cfg.o.outline_window.center_on_jump then if cfg.o.outline_window.center_on_jump then
vim.fn.win_execute(M.state.code_win, "normal! zz") vim.fn.win_execute(M.state.code_win, 'normal! zz')
end end
if vim.fn.hlexists('OutlineJumpHighlight') == 0 then if vim.fn.hlexists('OutlineJumpHighlight') == 0 then
@@ -177,7 +177,7 @@ local function update_cursor_style()
local hide_cursor = type(cl) ~= 'string' local hide_cursor = type(cl) ~= 'string'
if cl == 'focus_in_outline' or cl == 'focus_in_code' then if cl == 'focus_in_outline' or cl == 'focus_in_code' then
vim.api.nvim_win_set_option(0, "cursorline", cl == 'focus_in_outline') vim.api.nvim_win_set_option(0, 'cursorline', cl == 'focus_in_outline')
hide_cursor = cl == 'focus_in_outline' hide_cursor = cl == 'focus_in_outline'
end end
@@ -193,7 +193,7 @@ local function reset_cursor_style()
local cl = cfg.o.outline_window.show_cursorline local cl = cfg.o.outline_window.show_cursorline
if cl == 'focus_in_outline' or cl == 'focus_in_code' then if cl == 'focus_in_outline' or cl == 'focus_in_code' then
vim.api.nvim_win_set_option(0, "cursorline", cl ~= 'focus_in_outline') vim.api.nvim_win_set_option(0, 'cursorline', cl ~= 'focus_in_outline')
end end
-- vim.opt doesn't seem to provide a way to remove last item, like a pop() -- vim.opt doesn't seem to provide a way to remove last item, like a pop()
-- vim.o.guicursor = vim.o.guicursor:gsub(",n.-:.-$", "") -- vim.o.guicursor = vim.o.guicursor:gsub(",n.-:.-$", "")
@@ -430,13 +430,13 @@ local function handler(response, opts)
vim.api.nvim_del_autocmd(M.state.autocmds[M.state.code_win]) vim.api.nvim_del_autocmd(M.state.autocmds[M.state.code_win])
end end
if utils.str_or_nonempty_table(cfg.o.outline_window.auto_update_events.cursor) then if utils.str_or_nonempty_table(cfg.o.outline_window.auto_update_events.cursor) then
M.state.autocmds[M.state.code_win] = vim.api.nvim_create_autocmd( M.state.autocmds[M.state.code_win] =
cfg.o.outline_window.auto_update_events.cursor, vim.api.nvim_create_autocmd(cfg.o.outline_window.auto_update_events.cursor, {
{
buffer = vim.api.nvim_win_get_buf(M.state.code_win), buffer = vim.api.nvim_win_get_buf(M.state.code_win),
callback = function() M._highlight_current_item(nil) end callback = function()
} M._highlight_current_item(nil)
) end,
})
end end
end end
@@ -454,7 +454,8 @@ local function handler(response, opts)
M.state.outline_items = items M.state.outline_items = items
local current local current
M.state.flattened_outline_items, current = writer.make_outline(M.view.bufnr, items, M.state.code_win) M.state.flattened_outline_items, current =
writer.make_outline(M.view.bufnr, items, M.state.code_win)
M.update_cursor_pos(current) M.update_cursor_pos(current)
@@ -681,7 +682,7 @@ With bang, don't switch cursor focus to outline window.",
bang = true, bang = true,
}) })
cmd('Refresh', __refresh, { cmd('Refresh', __refresh, {
desc = "Trigger manual outline refresh of items.", desc = 'Trigger manual outline refresh of items.',
nargs = 0, nargs = 0,
}) })
end end