You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Formatting is very slow when called via zig#fmt#Format() and when using zig_fmt_autosave on neovim. In all of my testing I have found that running zig fmt ****.zig directly in the terminal is instant, so my suspicion is that the shell is too slow at pushing large amounts of data through stdout.
I tested with a file that has 2297 lines and got the following results (two different machines, so they aren't comparable to each other):
Windows (PowerShell): 31 seconds
Mac: 13 seconds
I really want to use format-on-save, but it really doesn't take long to hit a line count that leads to a pause on every save which is very distracting.
The workaround I am using now is to disable format-on-save and bind a key to run the shell command and reload the file manually: <cmd>!zig fmt %<CR><cmd>:e<CR><cmd>LspRestart<CR>. But it would be more convenient if I could just leave zig_fmt_autosave enabled. It's also problematic for new users as it isn't obvious that neovim includes this plugin and that it has format-on-save enabled by default and could give the impression that zig or zig fmt is slow.
Versions:
PS > nvim -v
NVIM v0.10.2
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
PS > zig version
0.13.0
The text was updated successfully, but these errors were encountered:
Formatting is very slow when called via
zig#fmt#Format()
and when usingzig_fmt_autosave
on neovim. In all of my testing I have found that runningzig fmt ****.zig
directly in the terminal is instant, so my suspicion is that the shell is too slow at pushing large amounts of data through stdout.I tested with a file that has 2297 lines and got the following results (two different machines, so they aren't comparable to each other):
I really want to use format-on-save, but it really doesn't take long to hit a line count that leads to a pause on every save which is very distracting.
The workaround I am using now is to disable format-on-save and bind a key to run the shell command and reload the file manually:
<cmd>!zig fmt %<CR><cmd>:e<CR><cmd>LspRestart<CR>
. But it would be more convenient if I could just leavezig_fmt_autosave
enabled. It's also problematic for new users as it isn't obvious that neovim includes this plugin and that it has format-on-save enabled by default and could give the impression that zig orzig fmt
is slow.Versions:
The text was updated successfully, but these errors were encountered: