I'm attempting to use a tiny autocmd to format my code before saving:
autocmd BufWritePre *.cs :OmniSharpCodeFormat
I expected this to run the code formatter, and then save the output. Instead, it runs the code formatter, which correctly changes the code in my buffer, and yet the saved file is the original pre-formatted buffer.
Not quite sure what I'm doing wrong here! Open to any thoughts or suggestions.
It looks like the method is indeed still asynchronous - I was looking for ways to try to await the asynchronous completion, but it seems like they added a callback:
function! s:CBCodeFormat() abort
noautocmd write
set nomodified
endfunction
autocmd BufWritePre *.cs call OmniSharp#actions#format#Format(function('s:CBCodeFormat'))