Fix #2295 - Respond to initialize with an initialized message

This commit is contained in:
w0rp
2019-02-15 08:54:53 +00:00
parent 89039187da
commit 0d10653a7c
10 changed files with 132 additions and 57 deletions

View File

@@ -299,7 +299,11 @@ function! ale#job#SendRaw(job_id, string) abort
if has('nvim')
call jobsend(a:job_id, a:string)
else
call ch_sendraw(job_getchannel(s:job_map[a:job_id].job), a:string)
let l:job = s:job_map[a:job_id].job
if ch_status(l:job) is# 'open'
call ch_sendraw(job_getchannel(l:job), a:string)
endif
endif
endfunction
@@ -323,6 +327,20 @@ function! ale#job#IsRunning(job_id) abort
return 0
endfunction
function! ale#job#HasOpenChannel(job_id) abort
if ale#job#IsRunning(a:job_id)
if has('nvim')
" TODO: Implement a check for NeoVim.
return 1
endif
" Check if the Job's channel can be written to.
return ch_status(s:job_map[a:job_id].job) is# 'open'
endif
return 0
endfunction
" Given a Job ID, stop that job.
" Invalid job IDs will be ignored.
function! ale#job#Stop(job_id) abort