aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop/handlers.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-07-08 11:47:02 +0100
committerAleksey Kladov <[email protected]>2019-07-08 11:47:02 +0100
commitb042faeb64d858c26b05dbf543925bf626454282 (patch)
tree105a681c9dd3ce924373a16f7d124308826a500a /crates/ra_lsp_server/src/main_loop/handlers.rs
parent227bc0b6d478564c45f49cb47dac963d9c37a528 (diff)
simplify
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-rw-r--r--crates/ra_lsp_server/src/main_loop/handlers.rs30
1 files changed, 7 insertions, 23 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs
index 8f07f5027..ab9ed5080 100644
--- a/crates/ra_lsp_server/src/main_loop/handlers.rs
+++ b/crates/ra_lsp_server/src/main_loop/handlers.rs
@@ -9,8 +9,7 @@ use lsp_types::{
9 TextDocumentIdentifier, TextEdit, WorkspaceEdit, 9 TextDocumentIdentifier, TextEdit, WorkspaceEdit,
10}; 10};
11use ra_ide_api::{ 11use ra_ide_api::{
12 AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RangeInfo, 12 AssistId, Cancelable, FileId, FilePosition, FileRange, FoldKind, Query, RunnableKind, Severity,
13 RunnableKind, Severity,
14}; 13};
15use ra_prof::profile; 14use ra_prof::profile;
16use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit}; 15use ra_syntax::{AstNode, SyntaxKind, TextRange, TextUnit};
@@ -267,13 +266,8 @@ pub fn handle_goto_definition(
267 None => return Ok(None), 266 None => return Ok(None),
268 Some(it) => it, 267 Some(it) => it,
269 }; 268 };
270 let nav_range = nav_info.range; 269 let res = (position.file_id, nav_info).try_conv_with(&world)?;
271 let res = nav_info 270 Ok(Some(res))
272 .info
273 .into_iter()
274 .map(|nav| (position.file_id, RangeInfo::new(nav_range, nav)))
275 .try_conv_with_to_vec(&world)?;
276 Ok(Some(res.into()))
277} 271}
278 272
279pub fn handle_goto_implementation( 273pub fn handle_goto_implementation(
@@ -285,13 +279,8 @@ pub fn handle_goto_implementation(
285 None => return Ok(None), 279 None => return Ok(None),
286 Some(it) => it, 280 Some(it) => it,
287 }; 281 };
288 let nav_range = nav_info.range; 282 let res = (position.file_id, nav_info).try_conv_with(&world)?;
289 let res = nav_info 283 Ok(Some(res))
290 .info
291 .into_iter()
292 .map(|nav| (position.file_id, RangeInfo::new(nav_range, nav)))
293 .try_conv_with_to_vec(&world)?;
294 Ok(Some(res.into()))
295} 284}
296 285
297pub fn handle_goto_type_definition( 286pub fn handle_goto_type_definition(
@@ -303,13 +292,8 @@ pub fn handle_goto_type_definition(
303 None => return Ok(None), 292 None => return Ok(None),
304 Some(it) => it, 293 Some(it) => it,
305 }; 294 };
306 let nav_range = nav_info.range; 295 let res = (position.file_id, nav_info).try_conv_with(&world)?;
307 let res = nav_info 296 Ok(Some(res))
308 .info
309 .into_iter()
310 .map(|nav| (position.file_id, RangeInfo::new(nav_range, nav)))
311 .try_conv_with_to_vec(&world)?;
312 Ok(Some(res.into()))
313} 297}
314 298
315pub fn handle_parent_module( 299pub fn handle_parent_module(