@@ -70,6 +70,8 @@ impl From<DocumentId> for PathOrId {
73+type FileCallback<T> = Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>;
73/// File path and range of lines (used to align and highlight lines)
75/// File path and range of lines (used to align and highlight lines)
74pub type FileLocation = (PathOrId, Option<(usize, usize)>);
76pub type FileLocation = (PathOrId, Option<(usize, usize)>);
@@ -80,7 +82,7 @@ pub struct FilePicker<T: Item> {
80 preview_cache: HashMap<PathBuf, CachedPreview>,
82 preview_cache: HashMap<PathBuf, CachedPreview>,
81 read_buffer: Vec<u8>,
83 read_buffer: Vec<u8>,
82 /// Given an item in the picker, return the file path and line number to display.
84 /// Given an item in the picker, return the file path and line number to display.
83− file_fn: Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>,
85+ file_fn: FileCallback<T>,
86pub enum CachedPreview {
88pub enum CachedPreview {
@@ -394,6 +396,8 @@ impl Ord for PickerMatch {
399+type PickerCallback<T> = Box<dyn Fn(&mut Context, &T, Action)>;
397pub struct Picker<T: Item> {
401pub struct Picker<T: Item> {
398 options: Vec<T>,
402 options: Vec<T>,
399 editor_data: T::Data,
403 editor_data: T::Data,
@@ -415,7 +419,7 @@ pub struct Picker<T: Item> {
415 /// Constraints for tabular formatting
419 /// Constraints for tabular formatting
416 widths: Vec<Constraint>,
420 widths: Vec<Constraint>,
418− callback_fn: Box<dyn Fn(&mut Context, &T, Action)>,
422+ callback_fn: PickerCallback<T>,
421impl<T: Item> Picker<T> {
425impl<T: Item> Picker<T> {