style: Run stylua
This commit is contained in:
@@ -10,7 +10,9 @@ local folding = require 'symbols-outline.folding'
|
||||
local M = {}
|
||||
|
||||
local function setup_global_autocmd()
|
||||
if config.options.highlight_hovered_item or config.options.auto_unfold_hover then
|
||||
if
|
||||
config.options.highlight_hovered_item or config.options.auto_unfold_hover
|
||||
then
|
||||
vim.api.nvim_create_autocmd('CursorHold', {
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
@@ -70,7 +72,10 @@ local function _update_lines()
|
||||
end
|
||||
|
||||
local function _merge_items(items)
|
||||
utils.merge_items_rec({ children = items }, { children = M.state.outline_items })
|
||||
utils.merge_items_rec(
|
||||
{ children = items },
|
||||
{ children = M.state.outline_items }
|
||||
)
|
||||
end
|
||||
|
||||
local function __refresh()
|
||||
@@ -192,7 +197,10 @@ function M._highlight_current_item(winnr)
|
||||
local cb = function(value)
|
||||
value.hovered = nil
|
||||
|
||||
if value.line == hovered_line or (hovered_line > value.range_start and hovered_line < value.range_end) then
|
||||
if
|
||||
value.line == hovered_line
|
||||
or (hovered_line > value.range_start and hovered_line < value.range_end)
|
||||
then
|
||||
value.hovered = true
|
||||
leaf_node = value
|
||||
end
|
||||
@@ -205,8 +213,8 @@ function M._highlight_current_item(winnr)
|
||||
if leaf_node then
|
||||
for index, node in ipairs(M.state.flattened_outline_items) do
|
||||
if node == leaf_node then
|
||||
vim.api.nvim_win_set_cursor(M.view.winnr, { index, 1 })
|
||||
break
|
||||
vim.api.nvim_win_set_cursor(M.view.winnr, { index, 1 })
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -230,7 +238,10 @@ local function setup_keymaps(bufnr)
|
||||
require('symbols-outline.hover').show_hover
|
||||
)
|
||||
-- preview symbol
|
||||
map(config.options.keymaps.toggle_preview, require('symbols-outline.preview').toggle)
|
||||
map(
|
||||
config.options.keymaps.toggle_preview,
|
||||
require('symbols-outline.preview').toggle
|
||||
)
|
||||
-- rename symbol
|
||||
map(
|
||||
config.options.keymaps.rename_symbol,
|
||||
@@ -251,23 +262,23 @@ local function setup_keymaps(bufnr)
|
||||
M.view:close()
|
||||
end)
|
||||
-- fold selection
|
||||
map( config.options.keymaps.fold, function ()
|
||||
map(config.options.keymaps.fold, function()
|
||||
M._set_folded(true)
|
||||
end)
|
||||
-- unfold selection
|
||||
map(config.options.keymaps.unfold, function ()
|
||||
map(config.options.keymaps.unfold, function()
|
||||
M._set_folded(false)
|
||||
end)
|
||||
-- fold all
|
||||
map(config.options.keymaps.fold_all, function ()
|
||||
map(config.options.keymaps.fold_all, function()
|
||||
M._set_all_folded(true)
|
||||
end)
|
||||
-- unfold all
|
||||
map(config.options.keymaps.unfold_all, function ()
|
||||
map(config.options.keymaps.unfold_all, function()
|
||||
M._set_all_folded(false)
|
||||
end)
|
||||
-- fold reset
|
||||
map(config.options.keymaps.fold_reset,function ()
|
||||
map(config.options.keymaps.fold_reset, function()
|
||||
M._set_all_folded(nil)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -25,4 +25,3 @@ M.is_folded = function(node)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ function M.show_hover()
|
||||
hover_params.bufnr,
|
||||
'textDocument/hover',
|
||||
hover_params,
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
function(_, result, _, config)
|
||||
if not (result and result.contents) then
|
||||
-- return { 'No information available' }
|
||||
|
||||
@@ -65,7 +65,6 @@ local function parse_result(result, depth, hierarchy, parent)
|
||||
end
|
||||
|
||||
node.children = children
|
||||
|
||||
end
|
||||
end
|
||||
return ret
|
||||
@@ -230,8 +229,11 @@ function M.get_lines(flattened_outline_items)
|
||||
elseif not node.hierarchy[index] and depth > 1 then
|
||||
line[index + marker_space] = ui.markers.vertical
|
||||
add_guide_hl(
|
||||
running_length - 1 + 2*marker_space,
|
||||
running_length + vim.fn.strlen(ui.markers.vertical) - 1 + 2 * marker_space
|
||||
running_length - 1 + 2 * marker_space,
|
||||
running_length
|
||||
+ vim.fn.strlen(ui.markers.vertical)
|
||||
- 1
|
||||
+ 2 * marker_space
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,15 +8,12 @@ function M.should_use_provider(bufnr)
|
||||
end
|
||||
|
||||
function M.hover_info(_, _, on_info)
|
||||
on_info(
|
||||
nil,
|
||||
{
|
||||
contents = {
|
||||
kind = 'markdown',
|
||||
contents = { 'No extra information availaible!' },
|
||||
},
|
||||
}
|
||||
)
|
||||
on_info(nil, {
|
||||
contents = {
|
||||
kind = 'markdown',
|
||||
contents = { 'No extra information availaible!' },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
---@param on_symbols function
|
||||
|
||||
@@ -23,15 +23,12 @@ function M.hover_info(bufnr, params, on_info)
|
||||
end
|
||||
|
||||
if not used_client then
|
||||
on_info(
|
||||
nil,
|
||||
{
|
||||
contents = {
|
||||
kind = 'markdown',
|
||||
content = { 'No extra information availaible!' },
|
||||
},
|
||||
}
|
||||
)
|
||||
on_info(nil, {
|
||||
contents = {
|
||||
kind = 'markdown',
|
||||
content = { 'No extra information availaible!' },
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
used_client.request('textDocument/hover', params, on_info, bufnr)
|
||||
|
||||
@@ -52,7 +52,19 @@ M.merge_items_rec = function(new_node, old_node, index, parent)
|
||||
failed = true
|
||||
else
|
||||
for key, _ in pairs(new_node) do
|
||||
if vim.tbl_contains({ 'parent', 'children', 'folded', 'hovered', 'line_in_outline', 'hierarchy' }, key) then
|
||||
if
|
||||
vim.tbl_contains(
|
||||
{
|
||||
'parent',
|
||||
'children',
|
||||
'folded',
|
||||
'hovered',
|
||||
'line_in_outline',
|
||||
'hierarchy',
|
||||
},
|
||||
key
|
||||
)
|
||||
then
|
||||
goto continue
|
||||
end
|
||||
|
||||
|
||||
@@ -74,7 +74,11 @@ M.add_hover_highlights = function(bufnr, nodes)
|
||||
end
|
||||
|
||||
local marker_fac = (config.options.fold_markers and 1) or 0
|
||||
ui.add_hover_highlight(bufnr, node.line_in_outline - 1, (node.depth + marker_fac) * 2)
|
||||
ui.add_hover_highlight(
|
||||
bufnr,
|
||||
node.line_in_outline - 1,
|
||||
(node.depth + marker_fac) * 2
|
||||
)
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user