I have the following in my vimrc:
vim9script
augroup my-go
au BufWritePre *.go {
try | silent undojoin | catch | endtry
var save = winsaveview()
exe ':%!gofmt 2>/dev/null || cat /dev/stdin'
winrestview(save)
}
augroup end
In Vim v9.2.0071 this works as expected:
./src/vim --clean +'source ~/gofmt.vim' a.go
On write it runs gofmt on the entire buffer to format it. Since Vim v9.2.0072 (1da9d13) this no longer works: it just seems to stop on that try | .. block. I tried splitting that over multiple lines, adding a pattern after the catch, and putting something in the catch block, but none of that seems to help.
Simpler reproducer that doesn't depend on gofmt:
vim9script
augroup my-go
au BufWritePre *.go {
try | silent undojoin | catch | endtry
echoerr 'XXX'
}
augroup end
You should see that error, but it never happens.
FYI @cuiweixie
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The problem seems to be the | being used as separators and no longer being detected. Does it work, if you instead use separate lines for each statement? If yes, I think the fix for this might be this here:
inside_block(exarg_T *eap) { int i; for (i = cstack->cs_idx; i >= 0; --i) { if (cstack->cs_flags[i] & CSF_BLOCK) return TRUE; if (cstack->cs_flags[i] & (CSF_TRY | CSF_WHILE | CSF_FOR)) return FALSE; } return FALSE; }
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The problem seems to be the ``| being used as separators
Nah, it fails with something like this too (none of the echoerrs show):
vim9script
augroup my-go
au BufWritePre *.go {
try
echoerr 'try'
silent undojoin
# or: catch /.*/
catch
echoerr 'catch'
endtry
echoerr 'XXX'
}
augroup end
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()