mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-06 18:46:49 +00:00
fixup! removed copilot from generated schema and command palette
This commit is contained in:
parent
47de4dcd32
commit
ae6a671fea
2 changed files with 6 additions and 16 deletions
|
@ -37,7 +37,7 @@ const COPILOT_NAMESPACE: &'static str = "copilot";
|
||||||
actions!(copilot, [NextSuggestion, PreviousSuggestion, Reinstall]);
|
actions!(copilot, [NextSuggestion, PreviousSuggestion, Reinstall]);
|
||||||
|
|
||||||
pub fn init(client: Arc<Client>, node_runtime: Arc<NodeRuntime>, cx: &mut MutableAppContext) {
|
pub fn init(client: Arc<Client>, node_runtime: Arc<NodeRuntime>, cx: &mut MutableAppContext) {
|
||||||
staff_mode::<staff_mode::Copilot, _>(cx, {
|
staff_mode(cx, {
|
||||||
move |cx| {
|
move |cx| {
|
||||||
cx.update_global::<collections::CommandPaletteFilter, _, _>(|filter, _cx| {
|
cx.update_global::<collections::CommandPaletteFilter, _, _>(|filter, _cx| {
|
||||||
filter.filtered_namespaces.remove(COPILOT_NAMESPACE);
|
filter.filtered_namespaces.remove(COPILOT_NAMESPACE);
|
||||||
|
@ -56,7 +56,7 @@ pub fn init(client: Arc<Client>, node_runtime: Arc<NodeRuntime>, cx: &mut Mutabl
|
||||||
sign_in::init(cx);
|
sign_in::init(cx);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
not_staff_mode::<staff_mode::Copilot, _>(cx, |cx| {
|
not_staff_mode(cx, |cx| {
|
||||||
cx.update_global::<collections::CommandPaletteFilter, _, _>(|filter, _cx| {
|
cx.update_global::<collections::CommandPaletteFilter, _, _>(|filter, _cx| {
|
||||||
filter.filtered_namespaces.insert(COPILOT_NAMESPACE);
|
filter.filtered_namespaces.insert(COPILOT_NAMESPACE);
|
||||||
filter.filtered_namespaces.insert(COPILOT_AUTH_NAMESPACE);
|
filter.filtered_namespaces.insert(COPILOT_AUTH_NAMESPACE);
|
||||||
|
|
|
@ -13,11 +13,11 @@ impl std::ops::Deref for StaffMode {
|
||||||
|
|
||||||
/// Despite what the type system requires me to tell you, the init function will only be called a once
|
/// 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.
|
/// as soon as we know that the staff mode is enabled.
|
||||||
pub fn staff_mode<S: StaffModeConfiguration, F: FnMut(&mut MutableAppContext) + 'static>(
|
pub fn staff_mode<F: FnMut(&mut MutableAppContext) + 'static>(
|
||||||
cx: &mut MutableAppContext,
|
cx: &mut MutableAppContext,
|
||||||
mut init: F,
|
mut init: F,
|
||||||
) {
|
) {
|
||||||
if !S::staff_only() || **cx.default_global::<StaffMode>() {
|
if **cx.default_global::<StaffMode>() {
|
||||||
init(cx)
|
init(cx)
|
||||||
} else {
|
} else {
|
||||||
let mut once = Some(());
|
let mut once = Some(());
|
||||||
|
@ -31,21 +31,11 @@ pub fn staff_mode<S: StaffModeConfiguration, F: FnMut(&mut MutableAppContext) +
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Immediately checks and runs the init function if the staff mode is not enabled.
|
/// 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>(
|
pub fn not_staff_mode<F: FnOnce(&mut MutableAppContext) + 'static>(
|
||||||
cx: &mut MutableAppContext,
|
cx: &mut MutableAppContext,
|
||||||
init: F,
|
init: F,
|
||||||
) {
|
) {
|
||||||
if !S::staff_only() || !**cx.default_global::<StaffMode>() {
|
if !**cx.default_global::<StaffMode>() {
|
||||||
init(cx)
|
init(cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait StaffModeConfiguration {
|
|
||||||
fn staff_only() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum Copilot {}
|
|
||||||
|
|
||||||
impl StaffModeConfiguration for Copilot {}
|
|
||||||
|
|
Loading…
Reference in a new issue