symbols-outline.nvim
symbols-outline.nvim copied to clipboard
Current symbol preview is Empty
When using this plugin, the symbol preview is always empty, regardless of which LSP is used.
Screenshots:
On sumneko_lua:
On Pyright:
On Jdtls:
Let me know if you need any other details on my config.
Until #181 is merged you can try this instead:
use {
"rbjorklin/symbols-outline.nvim",
branch = "fix-outline-detection"
}
Until #181 is merged you can try this instead:
use { "rbjorklin/symbols-outline.nvim", branch = "fix-outline-detection" }
I tried it and it works fine, thanks
I get the following error when using that branch:
toggle
:
E5108: Error executing lua ...acker/start/symbols-outline.nvim/lua/symbols-outline.lua:307: attempt to index field 'view' (a nil value)
stack traceback:
...acker/start/symbols-outline.nvim/lua/symbols-outline.lua:307: in function 'toggle_outline'
[string ":lua"]:1: in main chunk
open
:
E5108: Error executing lua ...acker/start/symbols-outline.nvim/lua/symbols-outline.lua:315: attempt to index field 'view' (a nil value)
stack traceback:
...acker/start/symbols-outline.nvim/lua/symbols-outline.lua:315: in function 'open_outline'
[string ":lua"]:1: in main chunk
@AniAggarwal I can recreate that error if I comment out all my configuration. Are you not initializing the plugin?
You need to explicitly configure this plugin in a file, for example: ~/.config/nvim/after/plugin/symbols.lua
local status, symbols = pcall(require, "symbols-outline")
if (not status) then return end
symbols.setup({
-- <config from README goes here>
})
I am, except I'm just doing it at once as it should be equivalent.
Config using packer:
use {
"rbjorklin/symbols-outline.nvim",
branch = "fix-outline-detection",
config = function()
require("symbols-outline").setup({ wrap = true })
end,
}
Error with this current setup:
Error executing vim.schedule lua callback: ...tart/symbols-outline.nvim/lua/symbols-outline/parser.lua:254: attempt to index a nil value
stack traceback:
...tart/symbols-outline.nvim/lua/symbols-outline/parser.lua:254: in function 'get_lines'
...tart/symbols-outline.nvim/lua/symbols-outline/writer.lua:91: in function 'parse_and_write'
...acker/start/symbols-outline.nvim/lua/symbols-outline.lua:301: in function 'callback'
/opt/nvim/usr/share/nvim/runtime/lua/vim/lsp.lua:1958: in function 'handler'
/opt/nvim/usr/share/nvim/runtime/lua/vim/lsp.lua:1390: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
EDIT: Using your setup with calling the setup in a different file results in the same above error.
Just to be clear, this plugin doesn't seem to have a working default configuration so you need to provide the entire config block from the README for it to work.
Oh, I didn't realize that. Here is current config and error:
Packer config:
use {
"rbjorklin/symbols-outline.nvim",
branch = "fix-outline-detection",
}
Symbols outline config:
local status, symbols = pcall(require, "symbols-outline")
if (not status) then return end
symbols.setup({
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = "right",
relative_width = true,
width = 25,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = "Pmenu",
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { "", "" },
wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { "<Esc>", "q" },
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
fold = "h",
unfold = "l",
fold_all = "W",
unfold_all = "E",
fold_reset = "R",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = "", hl = "TSURI" },
Module = { icon = "", hl = "TSNamespace" },
Namespace = { icon = "", hl = "TSNamespace" },
Package = { icon = "", hl = "TSNamespace" },
Class = { icon = "𝓒", hl = "TSType" },
Method = { icon = "ƒ", hl = "TSMethod" },
Property = { icon = "", hl = "TSMethod" },
Field = { icon = "", hl = "TSField" },
Constructor = { icon = "", hl = "TSConstructor" },
Enum = { icon = "ℰ", hl = "TSType" },
Interface = { icon = "ﰮ", hl = "TSType" },
Function = { icon = "", hl = "TSFunction" },
Variable = { icon = "", hl = "TSConstant" },
Constant = { icon = "", hl = "TSConstant" },
String = { icon = "𝓐", hl = "TSString" },
Number = { icon = "#", hl = "TSNumber" },
Boolean = { icon = "⊨", hl = "TSBoolean" },
Array = { icon = "", hl = "TSConstant" },
Object = { icon = "⦿", hl = "TSType" },
Key = { icon = "🔐", hl = "TSType" },
Null = { icon = "NULL", hl = "TSType" },
EnumMember = { icon = "", hl = "TSField" },
Struct = { icon = "𝓢", hl = "TSType" },
Event = { icon = "🗲", hl = "TSType" },
Operator = { icon = "+", hl = "TSOperator" },
TypeParameter = { icon = "𝙏", hl = "TSParameter" },
},
})
Error:
Error executing vim.schedule lua callback: ...tart/symbols-outline.nvim/lua/symbols-outline/parser.lua:254: attempt to index a nil value
stack traceback:
...tart/symbols-outline.nvim/lua/symbols-outline/parser.lua:254: in function 'get_lines'
...tart/symbols-outline.nvim/lua/symbols-outline/writer.lua:91: in function 'parse_and_write'
...acker/start/symbols-outline.nvim/lua/symbols-outline.lua:301: in function 'callback'
/opt/nvim/usr/share/nvim/runtime/lua/vim/lsp.lua:1958: in function 'handler'
/opt/nvim/usr/share/nvim/runtime/lua/vim/lsp.lua:1390: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Facing the same issue - were you able to fix this?
Yes. A few things:
Make sure this plugin and nvim treesitter are updated to the lastest version. Furthermore, the config needs to be changed to the following to fit the new namespaces with the latest treesitter update. Feel free to change/remove the custom icon declarations from my config.
symbols = require("symbols-outline")
symbols.setup({
highlight_hovered_item = true,
show_guides = true,
auto_preview = false,
position = "right",
relative_width = true,
width = 25,
auto_close = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = "Pmenu",
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { "", "" },
wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { "<Esc>", "q" },
goto_location = "<Cr>",
focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "K",
rename_symbol = "r",
code_actions = "a",
fold = "h",
unfold = "l",
fold_all = "W",
unfold_all = "E",
fold_reset = "R",
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = "", hl = "@text.uri" },
Module = { icon = "", hl = "@namespace" },
Namespace = { icon = "", hl = "@namespace" },
Package = { icon = "", hl = "@namespace" },
Class = { icon = "𝓒", hl = "@type" },
Method = { icon = "ƒ", hl = "@method" },
Property = { icon = "", hl = "@method" },
Field = { icon = "", hl = "@field" },
Constructor = { icon = "", hl = "@constructor" },
Enum = { icon = "ℰ", hl = "@type" },
Interface = { icon = "ﰮ", hl = "@type" },
Function = { icon = "", hl = "@function" },
Variable = { icon = "", hl = "@constant" },
Constant = { icon = "", hl = "@constant" },
String = { icon = "𝓐", hl = "@string" },
Number = { icon = "#", hl = "@number" },
Boolean = { icon = "⊨", hl = "@boolean" },
Array = { icon = "", hl = "@constant" },
Object = { icon = "⦿", hl = "@type" },
Key = { icon = "🔐", hl = "@type" },
Null = { icon = "NULL", hl = "@type" },
EnumMember = { icon = "", hl = "@field" },
Struct = { icon = "𝓢", hl = "@type" },
Event = { icon = "🗲", hl = "@type" },
Operator = { icon = "+", hl = "@operator" },
TypeParameter = { icon = "𝙏", hl = "@parameter" },
},
})
Check out this PR that updates the code in the README if you want to copy it from there instead of my config above: https://github.com/simrat39/symbols-outline.nvim/pull/191/commits/3fdc9942ee6726ac30621c5a91d424bb0eb74118
I'm still having issues with PHP files… I've updated my plugins, I've updated all treesitter parsers and I'm only getting previews for top-most elements (namespaces & classes). Is there something I'm missing?
Still getting an empty symbol preview even with the config in @AniAggarwal last post with the changes from the PR mentioned there. Using latest versions of both symbols-outline
and nvim-treesitter
. Is there anything else that might be needed or is something else wrong maybe?
The issues should be fixed now
Still getting an empty current symbol preview. It shows only the top-most elements. Are you able to get a preview for symbols except for the top-most level? Do you use something different in your config than the config provided a few posts above?
Same here. I get empty symbol preview except for the top level. symbols-outline
and tree-sitter
up to date. My symbols-outline
configuration:
config = function()
require('symbols-outline').setup({
highlight_hovered_item = true,
show_guides = true,
position = 'right',
border = 'single',
relative_width = true,
width = 25,
auto_close = false,
auto_preview = false,
show_numbers = false,
show_relative_numbers = false,
show_symbol_details = true,
preview_bg_highlight = 'Pmenu',
winblend = 0,
autofold_depth = nil,
auto_unfold_hover = true,
fold_markers = { '', '' },
wrap = false,
keymaps = { -- These keymaps can be a string or a table for multiple keys
close = { '<Esc>', 'q' },
goto_location = '<Cr>',
focus_location = 'o',
hover_symbol = '<C-space>',
toggle_preview = 'K',
rename_symbol = 'r',
code_actions = 'a',
show_help = '?',
fold = 'h',
unfold = 'l',
fold_all = 'W',
unfold_all = 'E',
fold_reset = 'R',
},
lsp_blacklist = {},
symbol_blacklist = {},
symbols = {
File = { icon = '', hl = '@text.uri' },
Module = { icon = '', hl = '@namespace' },
Namespace = { icon = '', hl = '@namespace' },
Package = { icon = '', hl = '@namespace' },
Class = { icon = '𝓒', hl = '@type' },
Method = { icon = 'ƒ', hl = '@method' },
Property = { icon = '', hl = '@method' },
Field = { icon = '', hl = '@field' },
Constructor = { icon = '', hl = '@constructor' },
Enum = { icon = 'ℰ', hl = '@type' },
Interface = { icon = 'ﰮ', hl = '@type' },
Function = { icon = '', hl = '@function' },
Variable = { icon = '', hl = '@constant' },
Constant = { icon = '', hl = '@constant' },
String = { icon = '𝓐', hl = '@string' },
Number = { icon = '#', hl = '@number' },
Boolean = { icon = '⊨', hl = '@boolean' },
Array = { icon = '', hl = '@constant' },
Object = { icon = '⦿', hl = '@type' },
Key = { icon = '🔐', hl = '@type' },
Null = { icon = 'NULL', hl = '@type' },
EnumMember = { icon = '', hl = '@field' },
Struct = { icon = '𝓢', hl = '@type' },
Event = { icon = '🗲', hl = '@type' },
Operator = { icon = '+', hl = '@operator' },
TypeParameter = { icon = '𝙏', hl = '@parameter' },
Component = { icon = '', hl = '@function' },
Fragment = { icon = '', hl = '@constant' },
}
})
end
@simrat39 This issue still exists and it should be re-opened.
I am also now experiencing this issue again and seeing as many others are, I'll reopen it.
same here
@RobertLemmens @AniAggarwal @rockyzhang24 @dpetka2001 @pipoprods @simrat39 u can use my fix branch to resolve this problem Packer:
use({
'enddeadroyal/symbols-outline.nvim', branch = 'bugfix/symbol-hover-misplacement'
})
because The following code has a problem
local node = so.state.outline_items[hovered_line]
fix is:(reference to hover.lua)
local node = so.state.flattened_outline_items[hovered_line]
It works !!!
@enddeadroyal Thank you for the fix. It works as supposed. Would you be willing to make a PR, so it can get merged upstream hopefully?