@@ -77,36 +77,6 @@ type FileCallback<T> = Box<dyn Fn(&Editor, &T) -> Option<FileLocation>>;
77/// File path and range of lines (used to align and highlight lines)
77/// File path and range of lines (used to align and highlight lines)
78pub type FileLocation = (PathOrId, Option<(usize, usize)>);
78pub type FileLocation = (PathOrId, Option<(usize, usize)>);
80−pub struct FilePicker<T: Item> {
82− editor_data: T::Data,
84− matcher: Box<Matcher>,
85− matches: Vec<PickerMatch>,
87− /// Current height of the completions box
88− completion_height: u16,
93− previous_pattern: (String, FuzzyQuery),
94− /// Whether to show the preview panel (default true)
96− /// Constraints for tabular formatting
97− widths: Vec<Constraint>,
99− callback_fn: PickerCallback<T>,
102− pub truncate_start: bool,
103− /// Caches paths to documents
104− preview_cache: HashMap<PathBuf, CachedPreview>,
105− read_buffer: Vec<u8>,
106− /// Given an item in the picker, return the file path and line number to display.
107− file_fn: FileCallback<T>,
110pub enum CachedPreview {
80pub enum CachedPreview {
111 Document(Box<Document>),
81 Document(Box<Document>),
@@ -144,6 +114,36 @@ impl Preview<'_, '_> {
117+pub struct FilePicker<T: Item> {
119+ editor_data: T::Data,
121+ matcher: Box<Matcher>,
122+ matches: Vec<PickerMatch>,
124+ /// Current height of the completions box
125+ completion_height: u16,
130+ previous_pattern: (String, FuzzyQuery),
131+ /// Whether to show the preview panel (default true)
133+ /// Constraints for tabular formatting
134+ widths: Vec<Constraint>,
136+ callback_fn: PickerCallback<T>,
139+ pub truncate_start: bool,
140+ /// Caches paths to documents
141+ preview_cache: HashMap<PathBuf, CachedPreview>,
142+ read_buffer: Vec<u8>,
143+ /// Given an item in the picker, return the file path and line number to display.
144+ file_fn: FileCallback<T>,
147impl<T: Item + 'static> FilePicker<T> {
147impl<T: Item + 'static> FilePicker<T> {
148 pub fn new(
148 pub fn new(
149 options: Vec<T>,
149 options: Vec<T>,