style: Run stylua
This commit is contained in:
@@ -10,7 +10,9 @@ local folding = require 'symbols-outline.folding'
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local function setup_global_autocmd()
|
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', {
|
vim.api.nvim_create_autocmd('CursorHold', {
|
||||||
pattern = '*',
|
pattern = '*',
|
||||||
callback = function()
|
callback = function()
|
||||||
@@ -70,7 +72,10 @@ local function _update_lines()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function _merge_items(items)
|
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
|
end
|
||||||
|
|
||||||
local function __refresh()
|
local function __refresh()
|
||||||
@@ -192,7 +197,10 @@ function M._highlight_current_item(winnr)
|
|||||||
local cb = function(value)
|
local cb = function(value)
|
||||||
value.hovered = nil
|
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
|
value.hovered = true
|
||||||
leaf_node = value
|
leaf_node = value
|
||||||
end
|
end
|
||||||
@@ -230,7 +238,10 @@ local function setup_keymaps(bufnr)
|
|||||||
require('symbols-outline.hover').show_hover
|
require('symbols-outline.hover').show_hover
|
||||||
)
|
)
|
||||||
-- preview symbol
|
-- 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
|
-- rename symbol
|
||||||
map(
|
map(
|
||||||
config.options.keymaps.rename_symbol,
|
config.options.keymaps.rename_symbol,
|
||||||
|
|||||||
@@ -25,4 +25,3 @@ M.is_folded = function(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ local function parse_result(result, depth, hierarchy, parent)
|
|||||||
end
|
end
|
||||||
|
|
||||||
node.children = children
|
node.children = children
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
@@ -231,7 +230,10 @@ function M.get_lines(flattened_outline_items)
|
|||||||
line[index + marker_space] = ui.markers.vertical
|
line[index + marker_space] = ui.markers.vertical
|
||||||
add_guide_hl(
|
add_guide_hl(
|
||||||
running_length - 1 + 2 * marker_space,
|
running_length - 1 + 2 * marker_space,
|
||||||
running_length + vim.fn.strlen(ui.markers.vertical) - 1 + 2 * marker_space
|
running_length
|
||||||
|
+ vim.fn.strlen(ui.markers.vertical)
|
||||||
|
- 1
|
||||||
|
+ 2 * marker_space
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,15 +8,12 @@ function M.should_use_provider(bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.hover_info(_, _, on_info)
|
function M.hover_info(_, _, on_info)
|
||||||
on_info(
|
on_info(nil, {
|
||||||
nil,
|
|
||||||
{
|
|
||||||
contents = {
|
contents = {
|
||||||
kind = 'markdown',
|
kind = 'markdown',
|
||||||
contents = { 'No extra information availaible!' },
|
contents = { 'No extra information availaible!' },
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param on_symbols function
|
---@param on_symbols function
|
||||||
|
|||||||
@@ -23,15 +23,12 @@ function M.hover_info(bufnr, params, on_info)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not used_client then
|
if not used_client then
|
||||||
on_info(
|
on_info(nil, {
|
||||||
nil,
|
|
||||||
{
|
|
||||||
contents = {
|
contents = {
|
||||||
kind = 'markdown',
|
kind = 'markdown',
|
||||||
content = { 'No extra information availaible!' },
|
content = { 'No extra information availaible!' },
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
used_client.request('textDocument/hover', params, on_info, bufnr)
|
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
|
failed = true
|
||||||
else
|
else
|
||||||
for key, _ in pairs(new_node) do
|
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
|
goto continue
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,11 @@ M.add_hover_highlights = function(bufnr, nodes)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local marker_fac = (config.options.fold_markers and 1) or 0
|
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::
|
::continue::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user