Skip to content

mini.breadcrumbs plugin to show breadcrumbs of current cursor position using treesitter. #983

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
231tr0n opened this issue Jun 21, 2024 · 7 comments
Open
2 tasks done
Labels
new-module Request for the new module

Comments

@231tr0n
Copy link

231tr0n commented Jun 21, 2024

Contributing guidelines

Module(s)

mini.breadcrumbs

Description

Is there any plan on adding something like nvim-navic to the mini.nvim suite of plugins. For getting breadcrumbs we can leverage treesitter or lsp as nvim-navic does or use nvim_treesitter#statusline() to get the current context and parse it accordingly into proper format.

@231tr0n 231tr0n added the feature-request Request for a feature to existing module label Jun 21, 2024
@echasnovski
Copy link
Owner

Thanks for the suggestion!

I like the idea of this "breadcrumbs" like functionality. My concern is about implementing it efficiently. Having to do more LSP requests on every text change (which I'd imagine what 'nvim-navic' has to do) is hard to do efficiently. Relying on 'nvim-treesitter' is not an option.

Besides, I try to stay away from both LSP specifications and tree-sitter because working with them is a challenge for me.

I'll think about it.

@echasnovski echasnovski added new-module Request for the new module and removed feature-request Request for a feature to existing module labels Oct 7, 2024
@joaomendoncaa
Copy link

joaomendoncaa commented Jan 17, 2025

+1 on breadcrumbs

Many people don't use tabs, and the breadcrumbs are awesome in big files with a lot of nesting.

I've been using this guy these past few years: barbecue.nvim — it's awesome and gets the job done — but it's an archived wrapper around navic, and I wouldn't mind removing one more plugin in favor of a well-thought-out mini module.

I don't have much to add to the above discussion, if I were to implement it myself, I would most likely succumb to treesitter.

Appreciate you.

@krovuxdev
Copy link

Hmm, that sounds like dropbar. I use dropbar quite a lot and I support the idea of breadcrumbs..

@ngpong
Copy link

ngpong commented Mar 9, 2025

Hi @echasnovski, I"m a loyal fan of mini and have integrated many mini modules into my configuration. I"m thrilled to see mini keep improving!

Just sharing my personal thoughts here - no other intentions. If you"re genuinely interested in breadcrumbs but concerned about performance, you might want to check out this single-file implementation I created (referencing two great projects: barbecue.nvim and dropbar.nvim) at: https://github.com/ngpong/dotfiles/blob/main/.config/nvim/lua/ngpong/core/winbar.lua. This mini breadcrumb already includes essential features, using LSP as the source while maintaining updates between 20-50µs. For simplicity, here are the core principles:

  1. Multi-thread processing for legacy symbol definitions, SymbolInformation.

  2. Binary search implementation.

  3. Maximize caching whenever possible.

  4. Relax LSP symbols update triggers (e.g., using TextChanged instead of TextChangedI).

Disclaimer: I take no maintenance responsibility for this code. While it works for my specific needs, you may need to adapt it for your environment. That said, simple modifications should be easily integrable into your own configuration.

Additional Note: While Tree-sitter could theoretically deliver better results, using it as source isn't reliable. It requires meticulous organization of relationships between returned nodes, and there's a high likelihood it would fail to meet performance expectations.

Best regards.

@echasnovski
Copy link
Owner

Thanks for the suggestion!

My thoughts for optimizing this would have been to use coroutines to make it more non-blocking. I thought about breadcrumbs-like functionality after diving into LSP lately, but still not sure if it'll be worth it. I personally don't use winbar (which is a perfect and reasonably only way to show this type of information), so it doesn't have high priority. But that reference file will be handy as a reference for the future, thanks!

@echaya
Copy link

echaya commented May 5, 2025

FWIW, I currently have navic displays on Mini.Statusline and seems serve the purpose well. I don't use winbar myself and use native tabs to switch between different work spaces.

Image

@echasnovski
Copy link
Owner

FWIW, I currently have navic displays on Mini.Statusline and seems serve the purpose well. I don't use winbar myself and use native tabs to switch between different work spaces.

Yeah, that's possible, but I prefer (and would like to suggest to users) to have file name shown in the window. Working with several split windows without it is not fun.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-module Request for the new module
Projects
None yet
Development

No branches or pull requests

6 participants