From e0a43a159d03a91d8cce07003d427df4f3d6966d Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 16 Aug 2018 13:46:31 +0300 Subject: vscode moves cursor --- crates/server/src/main_loop/mod.rs | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'crates/server/src/main_loop/mod.rs') diff --git a/crates/server/src/main_loop/mod.rs b/crates/server/src/main_loop/mod.rs index 4d5dfb437..1fbcc7d1f 100644 --- a/crates/server/src/main_loop/mod.rs +++ b/crates/server/src/main_loop/mod.rs @@ -171,21 +171,29 @@ fn on_request( let path_map = path_map.clone(); let sender = sender.clone(); pool.execute(move || { - let task = match handle_execute_command(world, path_map, params) { - Ok(req) => match to_value(req) { - Err(e) => Task::Die(e.into()), - Ok(params) => { - let request = RawRequest { - id: 0, - method: ::METHOD.to_string(), - params, - }; - Task::Request(request) - } - }, - Err(e) => Task::Die(e), + let (edit, cursor) = match handle_execute_command(world, path_map, params) { + Ok(res) => res, + Err(e) => return sender.send(Task::Die(e)), }; - sender.send(task) + match to_value(edit) { + Err(e) => return sender.send(Task::Die(e.into())), + Ok(params) => { + let request = RawRequest { + id: 0, + method: ::METHOD.to_string(), + params, + }; + sender.send(Task::Request(request)) + } + } + if let Some(cursor) = cursor { + let request = RawRequest { + id: 0, + method: ::METHOD.to_string(), + params: to_value(cursor).unwrap(), + }; + sender.send(Task::Request(request)) + } }); Ok(()) })?; -- cgit v1.2.3