@@ -11,11 +11,20 @@ use helix_view::editor::Action;
12use crate::{
12use crate::{
13 compositor::{self, Compositor},
13 compositor::{self, Compositor},
14− ui::{self, overlay::overlayed, FilePicker, Popup, Prompt, PromptEvent},
14+ ui::{self, overlay::overlayed, FileLocation, FilePicker, Popup, Prompt, PromptEvent},
17use std::borrow::Cow;
17use std::borrow::Cow;
19+fn location_to_file_location(location: &lsp::Location) -> FileLocation {
20+ let path = location.uri.to_file_path().unwrap();
22+ location.range.start.line as usize,
23+ location.range.end.line as usize,
19fn sym_picker(
28fn sym_picker(
20 symbols: Vec<lsp::SymbolInformation>,
29 symbols: Vec<lsp::SymbolInformation>,
21 current_path: Option<lsp::Url>,
30 current_path: Option<lsp::Url>,
@@ -55,14 +64,7 @@ fn sym_picker(
55 align_view(doc, view, Align::Center);
64 align_view(doc, view, Align::Center);
58− move |_editor, symbol| {
67+ move |_editor, symbol| Some(location_to_file_location(&symbol.location)),
59− let path = symbol.location.uri.to_file_path().unwrap();
61− symbol.location.range.start.line as usize,
62− symbol.location.range.end.line as usize,
67 picker.truncate_start = false;
69 picker.truncate_start = false;
@@ -465,15 +467,7 @@ fn goto_impl(
465 format!("{}:{}", file, line).into()
467 format!("{}:{}", file, line).into()
467 move |cx, location, action| jump_to(cx.editor, location, offset_encoding, action),
469 move |cx, location, action| jump_to(cx.editor, location, offset_encoding, action),
468− |_editor, location| {
470+ move |_editor, location| Some(location_to_file_location(location)),
469− // TODO: share code for symbol.location and location
470− let path = location.uri.to_file_path().unwrap();
472− location.range.start.line as usize,
473− location.range.end.line as usize,
478 compositor.push(Box::new(overlayed(picker)));
472 compositor.push(Box::new(overlayed(picker)));