Abort functions at first error.

This commit is contained in:
Andy Stewart
2016-05-13 14:14:41 +01:00
parent 264d7f3a66
commit cae4f72aa1
9 changed files with 102 additions and 102 deletions

View File

@@ -5,7 +5,7 @@ function! gitgutter#async#available()
return s:available
endfunction
function! gitgutter#async#execute(cmd)
function! gitgutter#async#execute(cmd) abort
let bufnr = gitgutter#utility#bufnr()
if has('nvim')
@@ -40,7 +40,7 @@ function! gitgutter#async#execute(cmd)
endfunction
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event)
function! gitgutter#async#handle_diff_job_nvim(job_id, data, event) abort
call gitgutter#debug#log('job_id: '.a:job_id.', event: '.a:event.', buffer: '.self.buffer)
let current_buffer = gitgutter#utility#bufnr()
@@ -70,13 +70,13 @@ endfunction
" Channel is in NL mode.
function! gitgutter#async#handle_diff_job_vim(channel, line)
function! gitgutter#async#handle_diff_job_vim(channel, line) abort
call gitgutter#debug#log('channel: '.a:channel.', line: '.a:line)
call s:accumulate_job_output(s:channel_id(a:channel), a:line)
endfunction
function! gitgutter#async#handle_diff_job_vim_close(channel)
function! gitgutter#async#handle_diff_job_vim_close(channel) abort
call gitgutter#debug#log('channel: '.a:channel)
let channel_id = s:channel_id(a:channel)
@@ -91,7 +91,7 @@ function! gitgutter#async#handle_diff_job_vim_close(channel)
endfunction
function! s:channel_id(channel)
function! s:channel_id(channel) abort
" This seems to be the only way to get info about the channel once closed.
return matchstr(a:channel, '\d\+')
endfunction
@@ -122,7 +122,7 @@ endfunction
" vim:
" id: channel's id
" arg: buffer number
function! s:job_started(id, ...)
function! s:job_started(id, ...) abort
if a:0 " vim
let s:jobs[a:id] = {'output': [], 'buffer': a:1}
else " nvim
@@ -130,16 +130,16 @@ function! s:job_started(id, ...)
endif
endfunction
function! s:is_job_started(id)
function! s:is_job_started(id) abort
return has_key(s:jobs, a:id)
endfunction
function! s:accumulate_job_output(id, line)
function! s:accumulate_job_output(id, line) abort
call add(s:jobs[a:id].output, a:line)
endfunction
" Returns a string
function! s:job_output(id)
function! s:job_output(id) abort
if has_key(s:jobs, a:id)
return gitgutter#utility#stringify(s:jobs[a:id].output)
else
@@ -147,11 +147,11 @@ function! s:job_output(id)
endif
endfunction
function! s:job_buffer(id)
function! s:job_buffer(id) abort
return s:jobs[a:id].buffer
endfunction
function! s:job_finished(id)
function! s:job_finished(id) abort
if has_key(s:jobs, a:id)
unlet s:jobs[a:id]
endif