simrat39 / symbols-outline.nvim

A tree like view for symbols in Neovim using the Language Server Protocol. Supports all your favourite languages.
MIT License
1.85k stars 97 forks source link

[BUG] Symbols from coc.nvim are not parsed properly #232

Open neur1n opened 11 months ago

neur1n commented 11 months ago

I'm using the latest symbols-outline.nvim with coc.nvim and get the following error messages when calling :SymbolsOutline:

...ols-outline.nvim/lua/symbols-outline/utils/lsp_utils.lua:45: attempt to index field 'location' (a nil value)
stack traceback:
^I...ols-outline.nvim/lua/symbols-outline/utils/lsp_utils.lua:45: in function 'get_selection_range'
^I...gged\symbols-outline.nvim/lua/symbols-outline/parser.lua:30: in function 'parse'
^I...vim\plugged\symbols-outline.nvim/lua/symbols-outline.lua:296: in function 'on_symbols'
^I...mbols-outline.nvim/lua/symbols-outline/providers/coc.lua:90: in function <...mbols-outline.nvim/lua/symbols-outline
/providers/coc.lua:89>

After some debugging, I found that it may be related to the returns of request_symbols function in coc.lua (link). The returned table cannot be resolved by the sort_symbols function in lsp_utils.lua.

Since I don't have nvim-lsp configured, I have no idea how to fix the request_symbols in coc.lua without a reference. I will be happy to create a PR if the return contents of other symbol provider are provided. Thanks.

adamency commented 8 months ago

@simrat39 can you please acknowledge this issue ? Symbols-Outline.nvim seems to be completely unusable when using CoC.nvim as the LSP client.

Thanks in advance !

wyg1997 commented 8 months ago

Facing the same problem here. Any suggestions for a quick fix? Thanks in advance for your assistance!