Skip to content
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

Print context using treesitter/lsp #54

Open
IndianBoy42 opened this issue May 19, 2023 · 9 comments
Open

Print context using treesitter/lsp #54

IndianBoy42 opened this issue May 19, 2023 · 9 comments
Labels
enhancement New feature or request
Milestone

Comments

@IndianBoy42
Copy link

Similar to this old plugin: https://github.com/polarmutex/contextprint.nvim

You might be interested in https://github.com/SmiteshP/nvim-navic to do the work of calculating the context from lsp

@andrewferrier
Copy link
Owner

Thanks, this is a really interesting idea! I won't be able to look at this this week but will definitely pop this on the backlog for action.

@andrewferrier
Copy link
Owner

@andrewferrier andrewferrier added the enhancement New feature or request label Apr 7, 2024
@andrewferrier andrewferrier changed the title feat: print context using treesitter/lsp Print context using treesitter/lsp Apr 28, 2024
@GopherJ
Copy link

GopherJ commented Jul 25, 2024

similar issue: #112

@andrewferrier
Copy link
Owner

Support different external plugins for doing this e.g. navic: https://github.com/PatschD/zippy.nvim

@andrewferrier
Copy link
Owner

So I've looked at zippy.nvim, and it's too flaky, as it relies on LSP attaches.

nvim-treesitter-context is also not suitable, it looks at what's "in view" on the screen as it uses it for drawing a breadcrumb, this is not what we need.

contextprint.nvim is too basic, dated, and relies on hardcoded TS approaches as opposed to queries.

I'm keeping this issue open, but right now I would like a simple way to do this via TS, or it's just adding too much complexity to this simple tool.

@andrewferrier
Copy link
Owner

Consider doing something really crude using indentation...

@andrewferrier
Copy link
Owner

OK, so indentation turns out not to be straightforward, as it's hard to account for blank lines in between blocks of code etc.

@MitjaBezensek
Copy link

Hey! Not sure if this will help, but https://github.com/ThePrimeagen/refactoring.nvim also has some logic for detecting the class / function (at least it works for TypeScript). Should be here in the debug folder.
https://github.com/ThePrimeagen/refactoring.nvim/tree/master/lua/refactoring/debug

@andrewferrier
Copy link
Owner

Thanks, I'll take a look when I get a moment!

@andrewferrier andrewferrier added this to the Epoch 4 milestone Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants