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