leodevbro / vscode-blockman

VSCode extension to highlight nested code blocks
https://github.com/leodevbro/vscode-blockman
MIT License
345 stars 16 forks source link

this extensions causes whole VSCode to hangle on extremely large files. e.g package-lock.json #91

Open Shahid-Roofi-Khan opened 1 year ago

Shahid-Roofi-Khan commented 1 year ago

There should be exclusion mechanism to exclude specific files like package-lock.json. (currently we can excluded all json files which is not ideal). Also there should be option to excuse files (project specific exclusions) because this extension basically can't handle very large size files so one should be able to make specific files excusion.

Otherwise it makes VSCode stuck and hang and one can't work at all.

leodevbro commented 1 year ago

Hello @Shahid-Roofi-Khan, it's kinda strange that you have such problem. On my machine, I have package-lock.json file with 38,000 lines, and Blockman needs just 1-2-3 seconds to render blocks in it. For me, 1-2-3 seconds is fine because I don't visit such large files very often. So, in your case, how many seconds does it take to render the blocks inside package-lock.json file? And how many lines does it have?

Shahid-Roofi-Khan commented 1 year ago

Hi @leodevbro thanks for responding for me, it makes VSCode completely useless on this file, i clone this repo and did npm i and it caused this issue: https://github.com/pgsandstrom/package-json-upgrade/blob/20c66b5783f5ed7cb5feb26b25886f994a3c4c37/package-lock.json#L1

only solution was to turn off all json and jsonc as exceptions. from where i was thinking if there was way to have specific files are exceptions because don't want to exempt all json files just for this package-lock.json file.

maybe its just a bug somewhere that happens in specific cases. try just this file and do npm i on this repo clone and try this file again, and it will make VSCode completely unusable and stuck with develop view showing this extension is hanging

leodevbro commented 1 year ago

I tested on that package-lock.json file and Blockman renders blocks in about 1.5 seconds (On my machine).

Please provide:

Shahid-Roofi-Khan commented 1 year ago

i have CPU - Intel(R) Core(TM) i7-4910MQ CPU @ 2.90GHz - Cores: 4 - Logical processors: 8 and 32GB Ram. let me try to reproduce the issue and either send you video or connect with me remote while i reproduce this issue so you can see.

leodevbro commented 1 year ago

I see my CPU (AMD Ryzen 7 2700X) seems much more powerful than i7-4910MQ.

https://www.cpubenchmark.net/compare/Intel-i7-4910MQ-vs-AMD-Ryzen-7-2700X

But I guess VS Code should not have such issues anyway.

Recording screen with the same machine is good, also remote watching is good, but these processes will further degrade performance during the test. So, maybe it's better to record screen with another device, maybe with your phone camera.

Shahid-Roofi-Khan commented 1 year ago

here is the VID: https://1drv.ms/v/s!AolGnJ22BpKGn0rzKXftLORn3wXP?e=1NWw6T

as you make changes in large file, make any single character change, it hangs for next many seconds and keep making changes, it totally stuck and one can't do anything. only solution that worked for me was to add json file as exceptions and reload vscode.

Shahid-Roofi-Khan commented 1 year ago

its latest VSCode todate (users installer). and not insiders edition.

leodevbro commented 1 year ago

Thank you. I'll see it later. I'm not at home right now.

leodevbro commented 1 year ago

Ok, I saw the video. Before I try to update Blockman with more customizations of which files should be included/excluded in terms of block-rendering, you can just use quick enable/disable command of Blockman. Press F1 and find "Blockman Toggle Enable/Disable", run it, so Blockman will be disabled super quickly, and run it again, and Blockman will be enabled super quickly. I don't recommend disabling Blockman from the extensions sidebar menu, because such disable/enable behavior will take more time.

So, before visiting large files, just disable blockman with that F1 command, and then enable it again. I hope this will make your experience better.

Shahid-Roofi-Khan commented 1 year ago

thanks @leodevbro i added jsonc as exclusion type in extension settings for now which helped because i noticed changes also come in effect when you restart vscode. however excluding all json files is not ideal. imho exclusions at project level should be there so any problematic large file can be exempted for particular projects as its very necessary.