Use update_default_global to filter command palette items for copilot
This commit is contained in:
parent
c76b9794e4
commit
e5192a4853
1 changed files with 4 additions and 4 deletions
|
@ -48,8 +48,8 @@ pub fn init(http: Arc<dyn HttpClient>, node_runtime: Arc<NodeRuntime>, cx: &mut
|
||||||
|
|
||||||
cx.observe(&copilot, |handle, cx| {
|
cx.observe(&copilot, |handle, cx| {
|
||||||
let status = handle.read(cx).status();
|
let status = handle.read(cx).status();
|
||||||
cx.update_global::<collections::CommandPaletteFilter, _, _>(
|
cx.update_default_global::<collections::CommandPaletteFilter, _, _>(move |filter, _cx| {
|
||||||
move |filter, _cx| match status {
|
match status {
|
||||||
Status::Disabled => {
|
Status::Disabled => {
|
||||||
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);
|
||||||
|
@ -62,8 +62,8 @@ pub fn init(http: Arc<dyn HttpClient>, node_runtime: Arc<NodeRuntime>, cx: &mut
|
||||||
filter.filtered_namespaces.insert(COPILOT_NAMESPACE);
|
filter.filtered_namespaces.insert(COPILOT_NAMESPACE);
|
||||||
filter.filtered_namespaces.remove(COPILOT_AUTH_NAMESPACE);
|
filter.filtered_namespaces.remove(COPILOT_AUTH_NAMESPACE);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
);
|
});
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue