|
|
|
@ -240,10 +240,7 @@ type SymbolPicker = FilePicker<SymbolInformationItem>;
|
|
|
|
|
|
|
|
|
|
fn sym_picker(symbols: Vec<SymbolInformationItem>, current_path: Option<lsp::Url>) -> SymbolPicker {
|
|
|
|
|
// TODO: drop current_path comparison and instead use workspace: bool flag?
|
|
|
|
|
FilePicker::new(
|
|
|
|
|
symbols,
|
|
|
|
|
current_path.clone(),
|
|
|
|
|
move |cx, item, action| {
|
|
|
|
|
FilePicker::new(symbols, current_path.clone(), move |cx, item, action| {
|
|
|
|
|
let (view, doc) = current!(cx.editor);
|
|
|
|
|
push_jump(view, doc);
|
|
|
|
|
|
|
|
|
@ -275,9 +272,8 @@ fn sym_picker(symbols: Vec<SymbolInformationItem>, current_path: Option<lsp::Url
|
|
|
|
|
doc.set_selection(view.id, Selection::single(range.head, range.anchor));
|
|
|
|
|
align_view(doc, view, Align::Center);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
move |_editor, item| Some(location_to_file_location(&item.symbol.location)),
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
.with_preview(move |_editor, item| Some(location_to_file_location(&item.symbol.location)))
|
|
|
|
|
.truncate_start(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -345,11 +341,11 @@ fn diag_picker(
|
|
|
|
|
align_view(doc, view, Align::Center);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
move |_editor, PickerDiagnostic { url, diag, .. }| {
|
|
|
|
|
)
|
|
|
|
|
.with_preview(move |_editor, PickerDiagnostic { url, diag, .. }| {
|
|
|
|
|
let location = lsp::Location::new(url.clone(), diag.range);
|
|
|
|
|
Some(location_to_file_location(&location))
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
.truncate_start(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1047,14 +1043,10 @@ fn goto_impl(
|
|
|
|
|
editor.set_error("No definition found.");
|
|
|
|
|
}
|
|
|
|
|
_locations => {
|
|
|
|
|
let picker = FilePicker::new(
|
|
|
|
|
locations,
|
|
|
|
|
cwdir,
|
|
|
|
|
move |cx, location, action| {
|
|
|
|
|
let picker = FilePicker::new(locations, cwdir, move |cx, location, action| {
|
|
|
|
|
jump_to_location(cx.editor, location, offset_encoding, action)
|
|
|
|
|
},
|
|
|
|
|
move |_editor, location| Some(location_to_file_location(location)),
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
.with_preview(move |_editor, location| Some(location_to_file_location(location)));
|
|
|
|
|
compositor.push(Box::new(overlaid(picker)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|