From f7fc1905a45645b2d7de12fae9fc77ba36b73103 Mon Sep 17 00:00:00 2001 From: hedy Date: Wed, 1 Nov 2023 15:33:26 +0800 Subject: [PATCH] fix(preview): Empty symbol preview Fix simrat39/symbols-outline.nvim#176 I was going to pull @enddeadroyal's commit from their 'bugfix/symbol-hover-misplacement' branch in their fork but they changed indentation so I had to apply the relevant changes myself instead. However, credits for this fix goes to @enddeadroyal from the issue commit in 176. Also fixed the "No info available" markdown as it wasn't rendering properly for me without a space after the '###'. --- README.md | 1 + lua/symbols-outline/preview.lua | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a91b016..832cf68 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ keep this list up to date. - Feat: when `auto_close=true` only auto close if `goto_location` is used (where focus changed), and not for `focus_location` (simrat39/symbols-outline.nvim#119) +- Fix symbol preview (simrat39/symbols-outline.nvim#176) - Fix `SymbolsOutlineClose` crashing when already closed: simrat39/symbols-outline.nvim#163 - Support Nerd fonts v3.0: simrat39/symbols-outline.nvim#225 - Fix newlines in symbols crash: simrat39/symbols-outline.nvim#204 (simrat39/symbols-outline.nvim#184) diff --git a/lua/symbols-outline/preview.lua b/lua/symbols-outline/preview.lua index 92556c2..047a717 100644 --- a/lua/symbols-outline/preview.lua +++ b/lua/symbols-outline/preview.lua @@ -49,7 +49,7 @@ end local function get_hovered_node() local hovered_line = vim.api.nvim_win_get_cursor(so.view.winnr)[1] - local node = so.state.outline_items[hovered_line] + local node = so.state.flattened_outline_items[hovered_line] return node end @@ -126,7 +126,7 @@ local function update_hover() end markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines) if vim.tbl_isempty(markdown_lines) then - markdown_lines = { '###No info available!' } + markdown_lines = { '### No info available!' } end markdown_lines = vim.lsp.util.stylize_markdown(