assistant2: Fix issue with included directories in context picker (#27833)
Release Notes: - N/A
This commit is contained in:
parent
5509e0141a
commit
d1db6d6782
2 changed files with 15 additions and 13 deletions
|
@ -321,10 +321,7 @@ pub fn render_file_context_entry(
|
||||||
|
|
||||||
let added = context_store.upgrade().and_then(|context_store| {
|
let added = context_store.upgrade().and_then(|context_store| {
|
||||||
if is_directory {
|
if is_directory {
|
||||||
context_store
|
context_store.read(cx).includes_directory(path)
|
||||||
.read(cx)
|
|
||||||
.includes_directory(path)
|
|
||||||
.map(FileInclusion::Direct)
|
|
||||||
} else {
|
} else {
|
||||||
context_store.read(cx).will_include_file_path(path, cx)
|
context_store.read(cx).will_include_file_path(path, cx)
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,14 +180,15 @@ impl ContextStore {
|
||||||
return Task::ready(Err(anyhow!("failed to read project")));
|
return Task::ready(Err(anyhow!("failed to read project")));
|
||||||
};
|
};
|
||||||
|
|
||||||
let already_included = if let Some(context_id) = self.includes_directory(&project_path.path)
|
let already_included = match self.includes_directory(&project_path.path) {
|
||||||
{
|
Some(FileInclusion::Direct(context_id)) => {
|
||||||
if remove_if_exists {
|
if remove_if_exists {
|
||||||
self.remove_context(context_id);
|
self.remove_context(context_id);
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
} else {
|
}
|
||||||
false
|
Some(FileInclusion::InDirectory(_)) => true,
|
||||||
|
None => false,
|
||||||
};
|
};
|
||||||
if already_included {
|
if already_included {
|
||||||
return Task::ready(Ok(()));
|
return Task::ready(Ok(()));
|
||||||
|
@ -509,8 +510,12 @@ impl ContextStore {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn includes_directory(&self, path: &Path) -> Option<ContextId> {
|
pub fn includes_directory(&self, path: &Path) -> Option<FileInclusion> {
|
||||||
self.directories.get(path).copied()
|
if let Some(context_id) = self.directories.get(path) {
|
||||||
|
return Some(FileInclusion::Direct(*context_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
self.will_include_file_path_via_directory(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn included_symbol(&self, symbol_id: &ContextSymbolId) -> Option<ContextId> {
|
pub fn included_symbol(&self, symbol_id: &ContextSymbolId) -> Option<ContextId> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue