File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,12 +10,20 @@ M.connect = function(connection_info, callback)
1010 local read_pipe = vim .uv .new_pipe ()
1111 assert (read_pipe ~= nil )
1212 read_pipe :open (conn .read_pipe_fd )
13+ local read_pipe_buffer = " "
1314 read_pipe :read_start (function (err , data )
1415 assert (read_callback , " Was sent a message with no read callback!\n The message: " .. data )
1516 if data then
16- for split_data in data :gmatch (" [^\r\n ]+" ) do
17- read_callback (err , vim .json .decode (split_data ))
17+ read_pipe_buffer = read_pipe_buffer .. data
18+ vim .schedule (function ()
19+ vim .notify (read_pipe_buffer )
20+ end )
21+ if string.sub (read_pipe_buffer , - 1 ) == " \n " then
22+ for split_data in read_pipe_buffer :gmatch (" [^\r\n ]+" ) do
23+ read_callback (err , vim .json .decode (split_data ))
24+ end
1825 end
26+ read_pipe_buffer = " "
1927 else
2028 read_callback (err , data )
2129 end
You can’t perform that action at this time.
0 commit comments