mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-13 05:53:50 -05:00
Update
This commit is contained in:
@@ -17,7 +17,7 @@ function! zig#fmt#Format() abort
|
||||
return
|
||||
endif
|
||||
|
||||
let cmdline = 'zig fmt --stdin'
|
||||
let cmdline = 'zig fmt --stdin --ast-check'
|
||||
let current_buf = bufnr('')
|
||||
|
||||
" The formatted code is output on stdout, the errors go on stderr.
|
||||
@@ -26,8 +26,19 @@ function! zig#fmt#Format() abort
|
||||
else
|
||||
silent let out = split(system(cmdline, current_buf))
|
||||
endif
|
||||
if len(out) == 1
|
||||
if out[0] == "error: unrecognized parameter: '--ast-check'"
|
||||
let cmdline = 'zig fmt --stdin'
|
||||
if exists('*systemlist')
|
||||
silent let out = systemlist(cmdline, current_buf)
|
||||
else
|
||||
silent let out = split(system(cmdline, current_buf))
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
let err = v:shell_error
|
||||
|
||||
|
||||
if err == 0
|
||||
" remove undo point caused via BufWritePre.
|
||||
try | silent undojoin | catch | endtry
|
||||
|
||||
Reference in New Issue
Block a user