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,21 @@ 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+ if string.sub (data , - 2 ) == " }\n " then
18+ read_pipe_buffer = read_pipe_buffer .. data
19+ else
20+ read_pipe_buffer = read_pipe_buffer .. string.sub (data , 1 , - 2 )
1821 end
22+ if string.sub (read_pipe_buffer , - 1 ) == " \n " then
23+ for split_data in read_pipe_buffer :gmatch (" [^\r\n ]+" ) do
24+ read_callback (err , vim .json .decode (split_data ))
25+ end
26+ end
27+ read_pipe_buffer = " "
1928 else
2029 read_callback (err , data )
2130 end
You can’t perform that action at this time.
0 commit comments