aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/conv.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-17 15:38:33 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-17 15:38:33 +0000
commit982f72c022b45629e6adbaef22884359d3495ecf (patch)
treecc1a13dcf026a72d76496fb8ee2643619560f471 /crates/ra_lsp_server/src/conv.rs
parentf937d11ad892036fa93b25a2c19d10dcebe4ab24 (diff)
parentfd5307e60d268423f7026db28b15bd2b31575396 (diff)
Merge #844
844: Refactor find_all_refs to return ReferenceSearchResult r=vipentti a=vipentti This refactors `find_all_refs` to return a new `ReferenceSearchResult` based on feedback in #839. There are few questions/notes regarding the refactor: 1. Introducing `NavigationTarget::from_bind_pat` this simply forwards the call to `NavigationTarget::from_named`, could we just expose `from_named` directly as `pub(crate)` ? 2. Added an utility method `NavigationTarget::range` since there were few places where you would use `self.focus_range.unwrap_or(self.full_range)` 3. Implementing `IntoIterator` for `ReferenceSearchResult`. This turns `ReferenceSearchResult` into an iterator over `FileRanges` and allows previous code to mostly stay as it was based on the order that `find_all_refs` previously had (declaration first and then the references). I'm not sure if there is a way of doing the conversion to `IntoIter` without the allocation of a new vector 4. Is it possible to have a binding without a name? I'm not sure if the `NavigationTarget::from_bind_pat` can cause some edge-cases that previously were ok This fixes #835. Co-authored-by: Ville Penttinen <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src/conv.rs')
-rw-r--r--crates/ra_lsp_server/src/conv.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index 20077a48a..c3192a1e5 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -333,7 +333,7 @@ impl TryConvWith for &NavigationTarget {
333 type Output = Location; 333 type Output = Location;
334 fn try_conv_with(self, world: &ServerWorld) -> Result<Location> { 334 fn try_conv_with(self, world: &ServerWorld) -> Result<Location> {
335 let line_index = world.analysis().file_line_index(self.file_id()); 335 let line_index = world.analysis().file_line_index(self.file_id());
336 let range = self.focus_range().unwrap_or(self.full_range()); 336 let range = self.range();
337 to_location(self.file_id(), range, &world, &line_index) 337 to_location(self.file_id(), range, &world, &line_index)
338 } 338 }
339} 339}