aboutsummaryrefslogtreecommitdiff
path: root/autoload/prettier
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/prettier')
-rw-r--r--autoload/prettier/job/async/neovim.vim4
-rw-r--r--autoload/prettier/job/async/vim.vim4
2 files changed, 5 insertions, 3 deletions
diff --git a/autoload/prettier/job/async/neovim.vim b/autoload/prettier/job/async/neovim.vim
index ce3b349..1cffe5c 100644
--- a/autoload/prettier/job/async/neovim.vim
+++ b/autoload/prettier/job/async/neovim.vim
@@ -42,7 +42,6 @@ endfunction
"
" note that somehow we exectuing both async and sync on nvim when using the autoformat
function! s:onExit(status, info, out, err) abort
- let s:prettier_job_running = 0
let l:currentBufferNumber = bufnr('%')
let l:isInsideAnotherBuffer = a:info.buf_nr != l:currentBufferNumber ? 1 : 0
let l:last = a:out[len(a:out) - 1]
@@ -51,6 +50,7 @@ function! s:onExit(status, info, out, err) abort
" parsing errors
if a:status != 0
call prettier#job#runner#onError(a:err)
+ let s:prettier_job_running = 0
return
endif
@@ -93,4 +93,6 @@ function! s:onExit(status, info, out, err) abort
call nvim_buf_set_lines(a:info.buf_nr, a:info.start, a:info.end, 0, l:out)
write
endif
+
+ let s:prettier_job_running = 0
endfunction
diff --git a/autoload/prettier/job/async/vim.vim b/autoload/prettier/job/async/vim.vim
index d84d406..ab0fbef 100644
--- a/autoload/prettier/job/async/vim.vim
+++ b/autoload/prettier/job/async/vim.vim
@@ -23,8 +23,6 @@ function! s:onError(msg) abort
endfunction
function! s:onClose(channel, startSelection, endSelection, bufferName) abort
- let s:prettier_job_running = 0
-
let l:out = []
let l:currentBufferName = bufname('%')
let l:isInsideAnotherBuffer = a:bufferName != l:currentBufferName ? 1 : 0
@@ -38,6 +36,7 @@ function! s:onClose(channel, startSelection, endSelection, bufferName) abort
" nothing to update
if (prettier#utils#buffer#willUpdatedLinesChangeBuffer(l:out, a:startSelection, a:endSelection) == 0)
+ let s:prettier_job_running = 0
return
endif
@@ -63,4 +62,5 @@ function! s:onClose(channel, startSelection, endSelection, bufferName) abort
else
call prettier#utils#buffer#replaceAndSave(l:out, a:startSelection, a:endSelection)
endif
+ let s:prettier_job_running = 0
endfunction