Extremely Slow Formatting
Hello, I have files that are not even over 200 lines which format almost instantly when running zig fmt .. but with this extension VS Code hangs for at least 3 seconds every time. I'm not sure what is causing this but it is consistently slow on my machine despite the CLI having performant results. I am on Windows
Hmm, from looking at https://github.com/ziglang/vscode-zig/blob/master/src/zigFormat.ts it seems we don't use buffered IO and it is piped through stdin to JS and then written. Would it be possible to have Zig write to the files when it knows that the current open file is an actual file (not a scratch pad) and in the other cases use stdin?
I have never experienced any slowness on Linux even when formatting 26k+ line files. Are you sure you have the extension configured to use a release build of Zig? Have you tried using zls as the formatting provider?
Hello, I have tried disabling all of the pertinent extensions all extensions except the Zig one and the problem still persists. I am not sure how to use zls as the formatting provider because when I do >Format Document With and then select the ZLS extension it does not do anything. Here's a video showcasing what happens every time for me:
https://user-images.githubusercontent.com/43641633/176674396-b60b56ac-4d44-4583-b36a-cf0466b714b9.mp4
.
@sno2 what is your CPU usage when formatting .zig file? If it's high, which process takes CPU time the most? Can it be somehow related to windows defender conflict? See #53
This is no longer happening for me. Thanks