chore(fmt): format using stylua

Also fixed something in .stylua.toml that may cause stylua to fail, by
the way
This commit is contained in:
27Onion Nebell
2025-04-14 22:39:13 +08:00
parent fc526beb6f
commit 7d2387dc12
7 changed files with 23 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
syntax = 'Lua52'
column_width = 100 column_width = 100
line_endings = 'Unix' line_endings = 'Unix'
indent_type = 'Spaces' indent_type = 'Spaces'

View File

@@ -69,7 +69,13 @@ function Float:open(lines, hl, title, indent)
self.ns = vim.api.nvim_create_namespace('OutlineHelp') self.ns = vim.api.nvim_create_namespace('OutlineHelp')
for _, h in ipairs(hl) do for _, h in ipairs(hl) do
if _G._outline_nvim_has[11] then if _G._outline_nvim_has[11] then
vim.hl.range(self.bufnr, self.ns, h.name, { h.line, h.from + indent }, { h.line, (h.to ~= -1 and h.to + indent) or -1 }) vim.hl.range(
self.bufnr,
self.ns,
h.name,
{ h.line, h.from + indent },
{ h.line, (h.to ~= -1 and h.to + indent) or -1 }
)
else else
---@diagnostic disable-next-line:deprecated ---@diagnostic disable-next-line:deprecated
vim.api.nvim_buf_add_highlight( vim.api.nvim_buf_add_highlight(

View File

@@ -10,7 +10,9 @@ local M = {
---@param bufnr integer ---@param bufnr integer
function M.clear_all_ns(bufnr) function M.clear_all_ns(bufnr)
if vim.api.nvim_buf_is_valid(bufnr) then if vim.api.nvim_buf_is_valid(bufnr) then
pcall(function() vim.api.nvim_buf_clear_namespace(bufnr, -1, 0, -1) end) pcall(function()
vim.api.nvim_buf_clear_namespace(bufnr, -1, 0, -1)
end)
end end
end end

View File

@@ -27,7 +27,7 @@ function M.supports_buffer(bufnr, config)
end end
end end
end end
return ft == "markdown" return ft == 'markdown'
end end
-- Parses markdown files and returns a table of SymbolInformation[] which is -- Parses markdown files and returns a table of SymbolInformation[] which is
@@ -47,8 +47,8 @@ function M.handle_markdown()
goto nextline goto nextline
end end
local next_value = lines[line+1] local next_value = lines[line + 1]
local is_emtpy_line = #value:gsub("^%s*(.-)%s*$", "%1") == 0 local is_emtpy_line = #value:gsub('^%s*(.-)%s*$', '%1') == 0
local header, title = string.match(value, '^(#+)%s+(.+)$') local header, title = string.match(value, '^(#+)%s+(.+)$')
if not header and next_value and not is_emtpy_line then if not header and next_value and not is_emtpy_line then

View File

@@ -161,10 +161,12 @@ local function legacy_rename(sidebar, client, node)
} }
local status, err local status, err
if _G._outline_nvim_has[11] then if _G._outline_nvim_has[11] then
status, err = client:request_sync('textDocument/rename', params, request_timeout, sidebar.code.buf) status, err =
client:request_sync('textDocument/rename', params, request_timeout, sidebar.code.buf)
else else
---@diagnostic disable-next-line ---@diagnostic disable-next-line
status, err = client.request_sync('textDocument/rename', params, request_timeout, sidebar.code.buf) status, err =
client.request_sync('textDocument/rename', params, request_timeout, sidebar.code.buf)
end end
if status == nil or status.err or err or status.result == nil then if status == nil or status.err or err or status.result == nil then
return false return false
@@ -236,7 +238,7 @@ function M.show_hover(sidebar)
local md_lines = l.util.convert_input_to_markdown_lines(status.result.contents) local md_lines = l.util.convert_input_to_markdown_lines(status.result.contents)
if _G._outline_nvim_has[10] then if _G._outline_nvim_has[10] then
md_lines = vim.split(status.result.contents, '\n', { trimempty = true }); md_lines = vim.split(status.result.contents, '\n', { trimempty = true })
else else
---@diagnostic disable-next-line:deprecated ---@diagnostic disable-next-line:deprecated
md_lines = l.util.trim_empty_lines(md_lines) md_lines = l.util.trim_empty_lines(md_lines)

View File

@@ -344,8 +344,8 @@ function Sidebar:__refresh()
if focused_outline or not self.view:is_open() then if focused_outline or not self.view:is_open() then
return return
end end
local ft = vim.api.nvim_get_option_value("ft", { buf = buf }) local ft = vim.api.nvim_get_option_value('ft', { buf = buf })
local listed = vim.api.nvim_get_option_value("ft", { buf = buf }) local listed = vim.api.nvim_get_option_value('ft', { buf = buf })
if ft == 'OutlineHelp' or not (listed or ft == 'help') then if ft == 'OutlineHelp' or not (listed or ft == 'help') then
return return
end end

View File

@@ -40,8 +40,8 @@ function M.flash_highlight(winnr, lnum, durationMs, hl_group)
local bufnr = vim.api.nvim_win_get_buf(winnr) local bufnr = vim.api.nvim_win_get_buf(winnr)
local ns local ns
if _G._outline_nvim_has[11] then if _G._outline_nvim_has[11] then
ns = vim.api.nvim_create_namespace("_outline_nvim_flash") ns = vim.api.nvim_create_namespace('_outline_nvim_flash')
vim.hl.range(bufnr, ns, hl_group, { lnum-1, 0 }, { lnum-1, -1 }) vim.hl.range(bufnr, ns, hl_group, { lnum - 1, 0 }, { lnum - 1, -1 })
else else
---@diagnostic disable-next-line:deprecated ---@diagnostic disable-next-line:deprecated
ns = vim.api.nvim_buf_add_highlight(bufnr, 0, hl_group, lnum - 1, 0, -1) ns = vim.api.nvim_buf_add_highlight(bufnr, 0, hl_group, lnum - 1, 0, -1)