hedyhli / outline.nvim

Code outline sidebar powered by LSP. Significantly enhanced & refactored fork of symbols-outline.nvim.
https://sr.ht/~hedy/outline.nvim
MIT License
543 stars 15 forks source link

No hierarchical structure #43

Closed LeonardoMor closed 8 months ago

LeonardoMor commented 8 months ago

You can see here color is a class, and its methods are at the same level as the class itself:

image

The same is true throughout the entire file. Here the provider is pylsp. The same thing happens when editing bash files, variables and functions are all at the same level regardless of some variables bein local to some functions.

hedyhli commented 8 months ago

Unfortunately, this is due to the language servers not capable of providing hierarchical information. In the future we'll be able to use treesitter in this case. For now, I recommend whitelisting only Function kind for these file types in the symbol filter config.

Closing as there's not much we can do on our side. If any fix or new information comes up feel free to reopen.

LeonardoMor commented 8 months ago

Unfortunately, this is due to the language servers not capable of providing hierarchical information. In the future we'll be able to use treesitter in this case. For now, I recommend whitelisting only Function kind for these file types in the symbol filter config.

Closing as there's not much we can do on our side. If any fix or new information comes up feel free to reopen.

Is there some log I can look at to investigate this?

This happens on two languages and Lua works fine. It might be a configuration issue

hedyhli commented 7 months ago

This happens on two languages and Lua works fine. It might be a configuration issue

What the outline is able to show is highly dependent on what the LSP is able to provide.

It happens with python and bash files because the LSPs used, pylsp and bashls respectively, do not appear to provide hierarchical symbols, in addition to the list of document symbols.

If the LSP cannot provide the information, outline.nvim can't do much more than simply displaying whatever (limited) information is provided by the LSP.

Is there some log I can look at to investigate this?

There is :LspLog, but I believe it would be irrelevant to this discussion because the issue lies in the capabilities of the LSP server.

Theoretically if there exists an LSP for python or bash that is able to provide hierarchy to the document symbols, it will be shown correctly in the outline.

Hope this clears things up :)

LeonardoMor commented 7 months ago

It does, thank you for replying.

It did some more testing, aerial behaves the same.

For Python, I switched to Pyright and it works well.

I am thinking about opening an issue on the bash lsp repo. For now, the outline only shows funtions for shell files as you suggested.

hedyhli commented 7 months ago

For Python, I switched to Pyright and it works well.

Thanks for this tip! I was using pylsp as well and I'm now considering to switch.