diff options
author | Aleksey Kladov <[email protected]> | 2018-08-16 11:46:31 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-16 11:46:31 +0100 |
commit | e0a43a159d03a91d8cce07003d427df4f3d6966d (patch) | |
tree | df27d9ea58452d447ad6614134f91fad9a583e8d /crates/server/src/main_loop/mod.rs | |
parent | eda52cbc348f37c1ae4391da901b2d605e161716 (diff) |
vscode moves cursor
Diffstat (limited to 'crates/server/src/main_loop/mod.rs')
-rw-r--r-- | crates/server/src/main_loop/mod.rs | 36 |
1 files changed, 22 insertions, 14 deletions
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( | |||
171 | let path_map = path_map.clone(); | 171 | let path_map = path_map.clone(); |
172 | let sender = sender.clone(); | 172 | let sender = sender.clone(); |
173 | pool.execute(move || { | 173 | pool.execute(move || { |
174 | let task = match handle_execute_command(world, path_map, params) { | 174 | let (edit, cursor) = match handle_execute_command(world, path_map, params) { |
175 | Ok(req) => match to_value(req) { | 175 | Ok(res) => res, |
176 | Err(e) => Task::Die(e.into()), | 176 | Err(e) => return sender.send(Task::Die(e)), |
177 | Ok(params) => { | ||
178 | let request = RawRequest { | ||
179 | id: 0, | ||
180 | method: <req::ApplyWorkspaceEdit as req::ClientRequest>::METHOD.to_string(), | ||
181 | params, | ||
182 | }; | ||
183 | Task::Request(request) | ||
184 | } | ||
185 | }, | ||
186 | Err(e) => Task::Die(e), | ||
187 | }; | 177 | }; |
188 | sender.send(task) | 178 | match to_value(edit) { |
179 | Err(e) => return sender.send(Task::Die(e.into())), | ||
180 | Ok(params) => { | ||
181 | let request = RawRequest { | ||
182 | id: 0, | ||
183 | method: <req::ApplyWorkspaceEdit as req::ClientRequest>::METHOD.to_string(), | ||
184 | params, | ||
185 | }; | ||
186 | sender.send(Task::Request(request)) | ||
187 | } | ||
188 | } | ||
189 | if let Some(cursor) = cursor { | ||
190 | let request = RawRequest { | ||
191 | id: 0, | ||
192 | method: <req::MoveCursor as req::ClientRequest>::METHOD.to_string(), | ||
193 | params: to_value(cursor).unwrap(), | ||
194 | }; | ||
195 | sender.send(Task::Request(request)) | ||
196 | } | ||
189 | }); | 197 | }); |
190 | Ok(()) | 198 | Ok(()) |
191 | })?; | 199 | })?; |