Closed rockyzhang24 closed 2 years ago
You seem to have found it! The aerial.get_location
function was added specifically to enable these sorts of integrations.
Wow, nice. So actually all exported functions in lua/aerial/init.lua
(i.e., those M.xxx
in init.lua
) are the public APIs you offer to users, right? If so, it is very hard to find them for some inexperienced neovim users, do you think it will be better to add documents for them, or at least mention them in the README?
Thank you.
Yep, I treat everything exposed in init.lua
as part of the API, and try to avoid breaking changes. The lack of documentation is intentional. For most users, they just want plugin to do what it does and to know how to customize it to work how they want. If they require anything other than setup()
and the exposed commands, then I've done something wrong.
The lua API is there for people such as yourself that have needs beyond the normal uses of aerial. I think those people will generally be able to find what they need, as you did, or they can post an issue/discussion question.
Got it. Thank you so much for your explanation. I think you can also enable the "Wiki" page that is good place as well to share some useful snippets.
I use winbar
to show the path of the file and the symbol path like what VSCode does. I attached the snippets in the discussion (https://github.com/stevearc/aerial.nvim/discussions/106). Thanks.
Feel free to close this. :P
Hello,
I know this plugin provides a
lualine
component for displaying the symbols structure for the current cursor position. It's fantastic, however, it is only available inlualine
. I am wondering whether it is possible to expose an API (a function) so that we can get this symbols structure by calling the function. If so, we can integrate in any other plugins. For example, I can show this symbols structure in thewinbar
(a new feature merged this morning https://github.com/neovim/neovim/pull/18562) instead of the statusline.I know there are some plugins offering a similar feature such as
nvim-treesitter
andnvim-gps
. But they display the symbols structure via treesitter, not LSP. Ifaerial
could expose such a API, we can display the symbols structure via LSP by setting its backends option.Any thoughts on this?
Thank you very much.
Update:
Currently I try to implement this via aerial builtin function
aerial.get_location()
(https://github.com/stevearc/aerial.nvim/blob/master/lua/aerial/init.lua#L127) and the functionformat_status()
for thelualine
component (https://github.com/stevearc/aerial.nvim/blob/master/lua/lualine/components/aerial.lua#L53).The implemented API is
output_symbols_structure(depth, separator, icons_enabled)
.Then we call the API by
lua output_symbols_structure(nil, ' > ', true)
and it will output the symbols structure shown below. This is really what I need.Any thoughts? Thank you so much.