@@ -48,7 +48,13 @@ function! s:insert_docstring(docstrings, end_lineno) abort
48
48
endfunction
49
49
50
50
function ! 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))
52
58
silent ! execute ' normal! 0'
53
59
let length = len (docstrings)
54
60
for docstring in docstrings
@@ -65,10 +71,11 @@ function! s:callback(msg, indent, start_lineno) abort
65
71
endfunction
66
72
67
73
function ! s: format_callback (msg, indent , start_lineno) abort
68
- call add (s: results , a: msg )
74
+ call extend (s: results , a: msg )
69
75
endfunction
70
76
71
77
function ! s: exit_callback (msg) abort
78
+ unlet s: job " Needed for Neovim
72
79
if len (s: results )
73
80
let view = winsaveview ()
74
81
silent execute ' % delete'
@@ -94,8 +101,8 @@ function! s:execute(cmd, lines, indent, start_lineno, cb, ex_cb) abort
94
101
95
102
let s: job = jobstart (a: cmd , {
96
103
\ ' 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 )},
98
104
\ ' on_exit' : {_c, m , _e - > a: ex_cb (m )},
105
+ \ ' stdout_buffered' : v: true ,
99
106
\ })
100
107
101
108
if exists (' *chansend' )
@@ -114,8 +121,8 @@ function! s:execute(cmd, lines, indent, start_lineno, cb, ex_cb) abort
114
121
endif
115
122
116
123
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 ] )},
119
126
\ ' in_mode' : ' nl' ,
120
127
\ })
121
128
0 commit comments