luckasRanarison / nvim-devdocs

Neovim DevDocs integration
MIT License
270 stars 20 forks source link

Window picker lags while scrolling through the doc options #18

Closed I-Own-You closed 1 year ago

I-Own-You commented 1 year ago

There is a problem that i encountered 1 day ago. When i enter in the window where i need to pick the documentation and i start to scroll (like hold the ctrl+n or ctrl+p), it lagged and after i released the key, it went down by n rows. After the update, now, i cant even press ctrl+p or ctrl+n without waiting 2-3 secs to see the changes.

For now i will disable the previewer in the source file, so i would not have lags while scrolling/going up/down

luckasRanarison commented 1 year ago

Could you precise the docs you used? I'm aware of the performance issues and I'm working on it.

I-Own-You commented 1 year ago

Could you precise the docs you used? I'm aware of the performance issues and I'm working on it.

all of them i have: go, django, javascript, typescript, lua, tailwind, html, django-rest-framework

luckasRanarison commented 1 year ago

There are no real performance improvement I can make at the moment because the plugin is directly fetching all the entries before opening the picker... The ideal would be to split the entries in different files as suggested in #14 and dynamically read them when using the picker

I-Own-You commented 1 year ago

take your time, no one is in hurry, ill just disable the previewer. Thanks for your work 💘

luckasRanarison commented 1 year ago

21 has slightly improved the picker performance but scrolling through docs with a single entry like lua-5.4 and lodash-4 is still laggy.

I-Own-You commented 1 year ago

is picker_cmd = false supposed to prevent preview of the markdown, on the right side of pickers window ?

emmanueltouzery commented 1 year ago

I don't really understand; I thought #17 and #21 would mean that for lodash we'd get multiple files in the devdocs data folder, and that these files would have been pre-processed by glow, but I see there is still a single md file, which explains the performance issues when scrolling. I have trouble reconciling that with the description of what #17 and #21 was supposed to be doing :thinking: ?

luckasRanarison commented 1 year ago

Sorry for the misunderstanding, actually the docs are splited in "main entries" which are already defined by the index.json and the website uses the same method. Most of the docs have like 1000 main entries so I thought it'd be more complex to split it further at the section level. Maybe I could handle these docs as special cases.

Also a note, glow itself is really slow.

emmanueltouzery commented 1 year ago

regarding glow's speed, I noticed this PR: https://github.com/charmbracelet/glow/pull/505

didn't test it yet.

emmanueltouzery commented 1 year ago

the glow PR was now merged and I can confirm the preview speed has now reduced to like 1-2 seconds for lodash.

However I can now see that it's displaying the whole lodash docs, not only the only for the selected functions, but that's covered by other bugs.

1-2 seconds is still lagging, but it's usable, while before it wasn't. But obviously a new version of glow must be released. But to fix the scrolling at the position of the current function/displaying only the current function maybe it'll be necessary to split the output anyway (I just don't know).

Note: a new version of glow will have to be released so that most people will get this performance improvement. In my case I built it from source.

luckasRanarison commented 1 year ago

Lodash docs are still messy at the moment because the converter can't handle nested tables and rowspan. Jumping with glow should already work, except for the telescope window (I need help with that). So, splitting isn't necessary. The reason why some jumps don't work is likely due to the incorrect path to the section.

luckasRanarison commented 1 year ago

Closing this as completed, see #42