HampusHauffman / block.nvim

209 stars 2 forks source link

Max File Size Setting #6

Open chrisgrieser opened 1 year ago

chrisgrieser commented 1 year ago

I noticed that in bigger files, there appears to be a considerable lag added when using this plugin. Especially with automatic = true, I think it might sense to have a setting for the maximum file size where this plugin is to be enabled (automatically)

HampusHauffman commented 1 year ago

Yes! I know that treesitter should allow to only update the code that is changed. This would reduce potential lag when editing a file. Are you experiencing lag when editing or just scrolling through the file?

If you want a temporary solution with max file size i'd be happy to look at a PR for this

chrisgrieser commented 1 year ago

oh sorry, I should have mentioned, the the lag already occurs when trying to open a big file, not only during editing

gennaro-tedesco commented 1 year ago

I am observing the same, in particular even character editing seem to be slow already for a file of around ~300 lines.

Wouldn't it be possible to only execute the parsing of the treesitter blocks for the portion of buffer on screen, or for the portion of code where the cursor is at? I remember that some other similar plugins suffer of the same problem, namely the treesitter parsing of the whole file after every action renders editing and scrolling very slow.

P. S. I never did any work myself with treesitter parsing, so please correct me in case some of what I said is nonsense :)