@@ -48,7 +48,13 @@ function! s:insert_docstring(docstrings, end_lineno) abort
4848endfunction
4949
5050function ! s: callback (msg, indent , start_lineno) abort
51- let docstrings = reverse (json_decode (a: msg ))
51+ let msg = join (a: msg , ' ' )
52+ " Check needed for Neovim
53+ if len (msg) == 0
54+ return
55+ endif
56+
57+ let docstrings = reverse (json_decode (msg))
5258 silent ! execute ' normal! 0'
5359 let length = len (docstrings)
5460 for docstring in docstrings
@@ -65,10 +71,11 @@ function! s:callback(msg, indent, start_lineno) abort
6571endfunction
6672
6773function ! s: format_callback (msg, indent , start_lineno) abort
68- call add (s: results , a: msg )
74+ call extend (s: results , a: msg )
6975endfunction
7076
7177function ! s: exit_callback (msg) abort
78+ unlet s: job " Needed for Neovim
7279 if len (s: results )
7380 let view = winsaveview ()
7481 silent execute ' % delete'
@@ -94,8 +101,8 @@ function! s:execute(cmd, lines, indent, start_lineno, cb, ex_cb) abort
94101
95102 let s: job = jobstart (a: cmd , {
96103 \ ' on_stdout' : {_c, m , _e - > a: cb (m , a: indent , a: start_lineno )},
97- \ ' on_stderr' : {_c, m , _e - > a: cb (m , a: indent , a: start_lineno )},
98104 \ ' on_exit' : {_c, m , _e - > a: ex_cb (m )},
105+ \ ' stdout_buffered' : v: true ,
99106 \ })
100107
101108 if exists (' *chansend' )
@@ -114,8 +121,8 @@ function! s:execute(cmd, lines, indent, start_lineno, cb, ex_cb) abort
114121 endif
115122
116123 let s: job = job_start (a: cmd , {
117- \ ' callback' : {_, m - > a: cb (m , a: indent , a: start_lineno )},
118- \ ' exit_cb' : {_, m - > a: ex_cb (m )},
124+ \ ' callback' : {_, m - > a: cb ([ m ] , a: indent , a: start_lineno )},
125+ \ ' exit_cb' : {_, m - > a: ex_cb ([ m ] )},
119126 \ ' in_mode' : ' nl' ,
120127 \ })
121128
0 commit comments