removed copilot from generated schema and command palette

This commit is contained in:
Mikayla Maki
2023-04-03 21:38:26 -07:00
parent 6bfecd7f66
commit 47de4dcd32
5 changed files with 43 additions and 5 deletions
+24 -3
View File
@@ -11,12 +11,13 @@ impl std::ops::Deref for StaffMode {
}
}
/// Despite what the type system requires me to tell you, the init function will only ever be called once
pub fn staff_mode<F: FnMut(&mut MutableAppContext) + 'static>(
/// Despite what the type system requires me to tell you, the init function will only be called a once
/// as soon as we know that the staff mode is enabled.
pub fn staff_mode<S: StaffModeConfiguration, F: FnMut(&mut MutableAppContext) + 'static>(
cx: &mut MutableAppContext,
mut init: F,
) {
if **cx.default_global::<StaffMode>() {
if !S::staff_only() || **cx.default_global::<StaffMode>() {
init(cx)
} else {
let mut once = Some(());
@@ -28,3 +29,23 @@ pub fn staff_mode<F: FnMut(&mut MutableAppContext) + 'static>(
.detach();
}
}
/// Immediately checks and runs the init function if the staff mode is not enabled.
pub fn not_staff_mode<S: StaffModeConfiguration, F: FnOnce(&mut MutableAppContext) + 'static>(
cx: &mut MutableAppContext,
init: F,
) {
if !S::staff_only() || !**cx.default_global::<StaffMode>() {
init(cx)
}
}
pub trait StaffModeConfiguration {
fn staff_only() -> bool {
true
}
}
pub enum Copilot {}
impl StaffModeConfiguration for Copilot {}