@@ -110,9 +110,9 @@ function M:start(opts)
110110 nvim_exe = " nvim"
111111 end
112112
113- local lua_cmd = string.format (" lua ServerPath.run(%s)" , Config .server_path or " " )
113+ local lua_cmd = string.format (" lua ServerPath.run(%s)" , Utils . lua_quote ( Config .server_path or " " ) )
114114
115- local cmd = { nvim_exe , " --headless" , " --noplugin" , " -u" , script_path , " -c" , lua_cmd }
115+ local cmd = { nvim_exe , " --headless" , " --noplugin" , " --clean " , " - u" , script_path , " -c" , lua_cmd }
116116
117117 vim .system (cmd , { text = true }, function (out )
118118 if out .code ~= 0 then
253253--- @param params table
254254--- @param callback ? function
255255function M :send_request (method , params , callback )
256- if not self :is_running () then
257- Logger .error (" ECA server is not running" )
258- if callback then
259- callback (" Server not running" , nil )
260- end
261- end
262256 local id = self :get_next_id ()
263257 local message = {
264258 jsonrpc = " 2.0" ,
@@ -272,6 +266,15 @@ function M:send_request(method, params, callback)
272266
273267 local json = vim .json .encode (message )
274268 table.insert (self .messages , { content = json , content_length = # json })
269+
270+ if not self :is_running () then
271+ Logger .error (" ECA server is not running" )
272+ if callback then
273+ callback (" Server not running" , nil )
274+ end
275+ return
276+ end
277+
275278 local content = string.format (" Content-Length: %d\r\n\r\n %s" , # json , json )
276279 self .process :write (content )
277280end
0 commit comments