diff options
author | Mikhail Modin <[email protected]> | 2020-01-03 15:30:45 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-01-08 14:21:54 +0000 |
commit | fb25c919793cc9aafbe57f61cd74d18146163ada (patch) | |
tree | ec7d616010741522ac4718ff472e8fc6307b2d24 /crates/ra_lsp_server | |
parent | 5d8f2bd822c1e9384ef547c781ccc26a6dec63e2 (diff) |
Adds a way to limits reference search by StructLiteral
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index 331beab13..c8f52eb0e 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -531,8 +531,8 @@ pub fn handle_references( | |||
531 | let locations = if params.context.include_declaration { | 531 | let locations = if params.context.include_declaration { |
532 | refs.into_iter() | 532 | refs.into_iter() |
533 | .filter_map(|r| { | 533 | .filter_map(|r| { |
534 | let line_index = world.analysis().file_line_index(r.file_id).ok()?; | 534 | let line_index = world.analysis().file_line_index(r.file_range.file_id).ok()?; |
535 | to_location(r.file_id, r.range, &world, &line_index).ok() | 535 | to_location(r.file_range.file_id, r.file_range.range, &world, &line_index).ok() |
536 | }) | 536 | }) |
537 | .collect() | 537 | .collect() |
538 | } else { | 538 | } else { |
@@ -540,8 +540,8 @@ pub fn handle_references( | |||
540 | refs.references() | 540 | refs.references() |
541 | .iter() | 541 | .iter() |
542 | .filter_map(|r| { | 542 | .filter_map(|r| { |
543 | let line_index = world.analysis().file_line_index(r.file_id).ok()?; | 543 | let line_index = world.analysis().file_line_index(r.file_range.file_id).ok()?; |
544 | to_location(r.file_id, r.range, &world, &line_index).ok() | 544 | to_location(r.file_range.file_id, r.file_range.range, &world, &line_index).ok() |
545 | }) | 545 | }) |
546 | .collect() | 546 | .collect() |
547 | }; | 547 | }; |
@@ -830,8 +830,11 @@ pub fn handle_document_highlight( | |||
830 | 830 | ||
831 | Ok(Some( | 831 | Ok(Some( |
832 | refs.into_iter() | 832 | refs.into_iter() |
833 | .filter(|r| r.file_id == file_id) | 833 | .filter(|r| r.file_range.file_id == file_id) |
834 | .map(|r| DocumentHighlight { range: r.range.conv_with(&line_index), kind: None }) | 834 | .map(|r| DocumentHighlight { |
835 | range: r.file_range.range.conv_with(&line_index), | ||
836 | kind: None, | ||
837 | }) | ||
835 | .collect(), | 838 | .collect(), |
836 | )) | 839 | )) |
837 | } | 840 | } |