chore(fmt): stylua
This commit is contained in:
@@ -167,10 +167,7 @@ end
|
||||
---@param conf table
|
||||
function M.get_preview_width(conf)
|
||||
if conf.relative_width then
|
||||
local relative_width = math.max(
|
||||
math.ceil(vim.o.columns * (conf.width / 100)),
|
||||
conf.min_width
|
||||
)
|
||||
local relative_width = math.max(math.ceil(vim.o.columns * (conf.width / 100)), conf.min_width)
|
||||
return relative_width
|
||||
else
|
||||
return conf.width
|
||||
@@ -182,10 +179,8 @@ end
|
||||
---@return integer
|
||||
function M.get_preview_height(conf, outline_height)
|
||||
if conf.relative_height then
|
||||
local relative_height = math.max(
|
||||
math.ceil(outline_height * (conf.height / 100)),
|
||||
conf.min_height
|
||||
)
|
||||
local relative_height =
|
||||
math.max(math.ceil(outline_height * (conf.height / 100)), conf.min_height)
|
||||
return relative_height
|
||||
else
|
||||
return conf.height
|
||||
|
||||
@@ -2,8 +2,8 @@ local Sidebar = require('outline.sidebar')
|
||||
local cfg = require('outline.config')
|
||||
local highlight = require('outline.highlight')
|
||||
local providers = require('outline.providers.init')
|
||||
local utils = require('outline.utils.init')
|
||||
local symbols = require('outline.symbols')
|
||||
local utils = require('outline.utils.init')
|
||||
|
||||
local M = {
|
||||
---@type outline.Sidebar[]
|
||||
|
||||
@@ -12,7 +12,7 @@ M.fetch_symbols_sync = function(bufnr)
|
||||
local items = {}
|
||||
local last_header
|
||||
local prev_lnum = 0
|
||||
local prev_line = ""
|
||||
local prev_line = ''
|
||||
local function finalize_header()
|
||||
if last_header then
|
||||
last_header.range['end'].line = prev_lnum - 1
|
||||
@@ -20,12 +20,12 @@ M.fetch_symbols_sync = function(bufnr)
|
||||
end
|
||||
end
|
||||
for lnum, line in ipairs(lines) do
|
||||
local header = line:match("^[A-Z].+")
|
||||
local padding, arg = line:match("^(%s+)(-.+)")
|
||||
local header = line:match('^[A-Z].+')
|
||||
local padding, arg = line:match('^(%s+)(-.+)')
|
||||
if header and lnum > 1 then
|
||||
finalize_header()
|
||||
local item = {
|
||||
kind = str_to_kind["Interface"],
|
||||
kind = str_to_kind['Interface'],
|
||||
name = header,
|
||||
level = 0,
|
||||
range = {
|
||||
@@ -35,10 +35,10 @@ M.fetch_symbols_sync = function(bufnr)
|
||||
}
|
||||
item.selectionRange = item.range
|
||||
if
|
||||
not config.post_parse_symbol
|
||||
or config.post_parse_symbol(bufnr, item, {
|
||||
backend_name = "man",
|
||||
lang = "man",
|
||||
not config.post_parse_symbol
|
||||
or config.post_parse_symbol(bufnr, item, {
|
||||
backend_name = 'man',
|
||||
lang = 'man',
|
||||
})
|
||||
~= false
|
||||
then
|
||||
@@ -47,7 +47,7 @@ M.fetch_symbols_sync = function(bufnr)
|
||||
end
|
||||
elseif arg then
|
||||
local item = {
|
||||
kind = str_to_kind["Interface"],
|
||||
kind = str_to_kind['Interface'],
|
||||
name = arg,
|
||||
level = last_header and 1 or 0,
|
||||
parent = last_header,
|
||||
@@ -58,10 +58,10 @@ M.fetch_symbols_sync = function(bufnr)
|
||||
}
|
||||
item.selectionRange = item.range
|
||||
if
|
||||
not config.post_parse_symbol
|
||||
or config.post_parse_symbol(bufnr, item, {
|
||||
backend_name = "man",
|
||||
lang = "man",
|
||||
not config.post_parse_symbol
|
||||
or config.post_parse_symbol(bufnr, item, {
|
||||
backend_name = 'man',
|
||||
lang = 'man',
|
||||
})
|
||||
~= false
|
||||
then
|
||||
|
||||
@@ -388,7 +388,7 @@ function Sidebar:__goto_location(change_focus)
|
||||
end
|
||||
|
||||
if not vim.api.nvim_win_is_valid(self.code.win) then
|
||||
vim.notify("outline.nvim: Code window closed", vim.log.levels.WARN)
|
||||
vim.notify('outline.nvim: Code window closed', vim.log.levels.WARN)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -47,7 +47,9 @@ end
|
||||
|
||||
-- use a stub if lspkind is missing or not configured
|
||||
local lspkind = {
|
||||
symbolic = function(kind, opts) return '' end
|
||||
symbolic = function(kind, opts)
|
||||
return ''
|
||||
end,
|
||||
}
|
||||
|
||||
---@param kind string|integer
|
||||
|
||||
@@ -26,13 +26,13 @@ function View:setup_view(split_command)
|
||||
|
||||
-- create a split
|
||||
vim.cmd(split_command)
|
||||
|
||||
|
||||
-- get current (outline) window and attach our buffer to it
|
||||
self.win = vim.api.nvim_get_current_win()
|
||||
vim.api.nvim_win_set_buf(self.win, self.buf)
|
||||
|
||||
-- resize if split_command not specify width like "25vsplit"
|
||||
if split_command:match("%d+") == nil then
|
||||
if split_command:match('%d+') == nil then
|
||||
-- resize to a % of the current window size
|
||||
vim.cmd('vertical resize ' .. cfg.o.outline_window.width)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user