andrewferrier / debugprint.nvim

Debugging in NeoVim the print() way!
MIT License
367 stars 23 forks source link

Print context using treesitter/lsp #54

Open IndianBoy42 opened 1 year ago

IndianBoy42 commented 1 year ago

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 commented 1 year ago

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 commented 11 months ago

Also look at https://github.com/nvim-treesitter/nvim-treesitter-context

GopherJ commented 4 months ago

similar issue: https://github.com/andrewferrier/debugprint.nvim/issues/112

andrewferrier commented 2 months ago

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

andrewferrier commented 2 months ago

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 commented 2 months ago

Consider doing something really crude using indentation...

andrewferrier commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

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