Add copilot menu item for enabling paths by glob

This commit is contained in:
Max Brunsfeld 2023-05-02 19:56:45 -07:00
parent c485fc86a2
commit 8eb1312deb
12 changed files with 432 additions and 232 deletions

View file

@ -3084,26 +3084,14 @@ impl Editor {
) -> bool {
let settings = cx.global::<Settings>();
let path = snapshot.file_at(location).map(|file| file.path());
let language_name = snapshot
.language_at(location)
.map(|language| language.name());
if !settings.show_copilot_suggestions(language_name.as_deref()) {
if !settings.show_copilot_suggestions(language_name.as_deref(), path.map(|p| p.as_ref())) {
return false;
}
let file = snapshot.file_at(location);
if let Some(file) = file {
let path = file.path();
if settings
.copilot
.disabled_globs
.iter()
.any(|glob| glob.matches_path(path))
{
return false;
}
}
true
}