luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
270 stars 20 forks source link

feat: ability to search in installed apidocs #66

Open emmanueltouzery opened 12 months ago

emmanueltouzery commented 12 months ago

i think this feature is useful. maybe it's a little crude, but it's better than not having the feature at all...

luckasRanarison commented 12 months ago

Intersting, I didn't know I needed this until now. But naming it DevdocsGrep would be better I think.

emmanueltouzery commented 12 months ago

Sure, I can rename it a little later today! Why I wrote it was crude...

But going all the way would be quite a lot more work, and possibly too slow to be useful. I guess this is good enough, and can be improved though time potentially.

emmanueltouzery commented 12 months ago

modified the PR to now use the Grep terminology.

luckasRanarison commented 12 months ago

I think displaying the raw markdown is okay in this case, using glow actually doesn't make sense. I found that we can hook into the live_grep builtin and change the display by passing a custom entry_maker. Having this with floating window would aso be nice but it seems that we can't directly change the default selection mapping, so that'd require some silly workaround. I'll take a closer look and try some stuff later but I think it can be improved.

luckasRanarison commented 12 months ago

So I improved the result display format and made it a little bit fancy... I also want to customize the other pickers now...

  • it doesn't respect the setting to pipe though glow

I only realize it now, I thought you were talking about the previewer. Yes, the picker would just open the file in the current implementation.

luckasRanarison commented 12 months ago

We could get the last preview buffer using telescope.state but the main problem is making it work with glow. We don't have enough information so we'd have to pass the entire buffer to glow, and you know what'd would happen with large files... I also don't know how we can implement jumping in this case. Any thoughts on this?

emmanueltouzery commented 12 months ago

Yes I think if we can't cut up the file at least to a large degree it's not going to work out. Otherwise of course we could use the telescope live_grep preview code to see how they focus a certain line, if they can do it presumably we can too, but yes, splitting is the issue.

Otherwise I didn't test what you did yet, but it's looking great!

luckasRanarison commented 12 months ago

Glow output doesn't necessarily match the original one so jumping to the specified line won't always work. But this feature is still great and I just learned about conceallevel, with it set to 3 previewing raw markdown in neovim with treesitter is almost good as using glow. I'm working on some fixes now and I'll set it to 3 by default.