Wrap earlier
This commit is contained in:
parent
cf8e056ec4
commit
38128bab3e
2 changed files with 10 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
use std::ops::Range;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
|
||||
|
@ -25,17 +25,16 @@ use crate::context_picker::file_context_picker::{extract_file_name_and_directory
|
|||
|
||||
#[derive(Default)]
|
||||
pub struct MentionSet {
|
||||
paths_by_crease_id: HashMap<CreaseId, MentionUri>,
|
||||
uri_by_crease_id: HashMap<CreaseId, MentionUri>,
|
||||
}
|
||||
|
||||
impl MentionSet {
|
||||
pub fn insert(&mut self, crease_id: CreaseId, path: PathBuf) {
|
||||
self.paths_by_crease_id
|
||||
.insert(crease_id, MentionUri::File(path));
|
||||
pub fn insert(&mut self, crease_id: CreaseId, uri: MentionUri) {
|
||||
self.uri_by_crease_id.insert(crease_id, uri);
|
||||
}
|
||||
|
||||
pub fn drain(&mut self) -> impl Iterator<Item = CreaseId> {
|
||||
self.paths_by_crease_id.drain().map(|(id, _)| id)
|
||||
self.uri_by_crease_id.drain().map(|(id, _)| id)
|
||||
}
|
||||
|
||||
pub fn contents(
|
||||
|
@ -44,7 +43,7 @@ impl MentionSet {
|
|||
cx: &mut App,
|
||||
) -> Task<Result<HashMap<CreaseId, Mention>>> {
|
||||
let contents = self
|
||||
.paths_by_crease_id
|
||||
.uri_by_crease_id
|
||||
.iter()
|
||||
.map(|(crease_id, uri)| match uri {
|
||||
MentionUri::File(path) => {
|
||||
|
@ -328,7 +327,7 @@ fn confirm_completion_callback(
|
|||
};
|
||||
|
||||
if let Some(crease_id) = crease_id {
|
||||
mention_set.lock().insert(crease_id, path);
|
||||
mention_set.lock().insert(crease_id, MentionUri::File(path));
|
||||
}
|
||||
});
|
||||
false
|
||||
|
|
|
@ -640,7 +640,9 @@ impl AcpThreadView {
|
|||
);
|
||||
|
||||
if let Some(crease_id) = crease_id {
|
||||
mention_set.lock().insert(crease_id, project_path);
|
||||
mention_set
|
||||
.lock()
|
||||
.insert(crease_id, MentionUri::File(project_path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue