NotAShelf / nvf

A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS.
https://notashelf.github.io/nvf/
MIT License
212 stars 29 forks source link

Opening big javascript files makes neovim laggy and it freezes completely #244

Closed justchokingaround closed 6 months ago

justchokingaround commented 7 months ago

⚠️ Please verify that this bug has NOT been reported before.

Description

This seems to only happen with obfuscated javascript files. Navigating through the log which I made to be 50K+ lines long worked just fine. (I didn't find anything useful in there btw, so I didn't post anything in the log section).

👟 Reproduction steps

Open a file thats over 20k lines long, for example the one from here: https://embed.smashystream.com/pl3.js?v=0.13

👀 Expected behavior

I should be able to format it and navigate through it quickly. (Even in VSCode I am able to do that, just fine).

😓 Actual Behavior

Neovim lags and then freezes entirely

💻 Metadata

📝 Relevant log output

nothing relevant
horriblename commented 6 months ago

treesitter plugins don't work great in big files apparently

TSDisable highlight
TSDisable illuminate

with this nvim is not freezing for me anymore

bigfile.nvim would be helpful for handling big files. though, it detects at smallest 1MiB files, the test file you gave was only 815KB lol

NotAShelf commented 6 months ago

In #261 I've added an option to optionally disable Treesitter highlighting for file types or with functions, which you can use to disable highlighting on files larger than a certain size.

NotAShelf commented 6 months ago

Seeing v0.6 is now merged main, I am closing this issue. For people potentially visiting in the future, I have left an example in the documentation for vim.treesitter.highlight.disable. You may view it online or using the manpages.