Put /docs
behind a feature flag (#16000)
This PR puts the `/docs` slash command behind a feature flag. Release Notes: - N/A
This commit is contained in:
parent
bd59af1df5
commit
abb6d40fbf
2 changed files with 22 additions and 4 deletions
|
@ -280,7 +280,6 @@ fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut
|
||||||
slash_command_registry.register_command(term_command::TermSlashCommand, true);
|
slash_command_registry.register_command(term_command::TermSlashCommand, true);
|
||||||
slash_command_registry.register_command(now_command::NowSlashCommand, true);
|
slash_command_registry.register_command(now_command::NowSlashCommand, true);
|
||||||
slash_command_registry.register_command(diagnostics_command::DiagnosticsSlashCommand, true);
|
slash_command_registry.register_command(diagnostics_command::DiagnosticsSlashCommand, true);
|
||||||
slash_command_registry.register_command(docs_command::DocsSlashCommand, true);
|
|
||||||
if let Some(prompt_builder) = prompt_builder {
|
if let Some(prompt_builder) = prompt_builder {
|
||||||
slash_command_registry.register_command(
|
slash_command_registry.register_command(
|
||||||
workflow_command::WorkflowSlashCommand::new(prompt_builder),
|
workflow_command::WorkflowSlashCommand::new(prompt_builder),
|
||||||
|
@ -289,9 +288,21 @@ fn register_slash_commands(prompt_builder: Option<Arc<PromptBuilder>>, cx: &mut
|
||||||
}
|
}
|
||||||
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
|
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
|
||||||
|
|
||||||
cx.observe_flag::<search_command::SearchSlashCommandFeatureFlag, _>(move |is_enabled, _cx| {
|
cx.observe_flag::<docs_command::DocsSlashCommandFeatureFlag, _>({
|
||||||
if is_enabled {
|
let slash_command_registry = slash_command_registry.clone();
|
||||||
slash_command_registry.register_command(search_command::SearchSlashCommand, true);
|
move |is_enabled, _cx| {
|
||||||
|
if is_enabled {
|
||||||
|
slash_command_registry.register_command(docs_command::DocsSlashCommand, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.detach();
|
||||||
|
cx.observe_flag::<search_command::SearchSlashCommandFeatureFlag, _>({
|
||||||
|
let slash_command_registry = slash_command_registry.clone();
|
||||||
|
move |is_enabled, _cx| {
|
||||||
|
if is_enabled {
|
||||||
|
slash_command_registry.register_command(search_command::SearchSlashCommand, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -7,6 +7,7 @@ use anyhow::{anyhow, bail, Result};
|
||||||
use assistant_slash_command::{
|
use assistant_slash_command::{
|
||||||
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
|
ArgumentCompletion, SlashCommand, SlashCommandOutput, SlashCommandOutputSection,
|
||||||
};
|
};
|
||||||
|
use feature_flags::FeatureFlag;
|
||||||
use gpui::{AppContext, BackgroundExecutor, Model, Task, WeakView};
|
use gpui::{AppContext, BackgroundExecutor, Model, Task, WeakView};
|
||||||
use indexed_docs::{
|
use indexed_docs::{
|
||||||
DocsDotRsProvider, IndexedDocsRegistry, IndexedDocsStore, LocalRustdocProvider, PackageName,
|
DocsDotRsProvider, IndexedDocsRegistry, IndexedDocsStore, LocalRustdocProvider, PackageName,
|
||||||
|
@ -18,6 +19,12 @@ use ui::prelude::*;
|
||||||
use util::{maybe, ResultExt};
|
use util::{maybe, ResultExt};
|
||||||
use workspace::Workspace;
|
use workspace::Workspace;
|
||||||
|
|
||||||
|
pub(crate) struct DocsSlashCommandFeatureFlag;
|
||||||
|
|
||||||
|
impl FeatureFlag for DocsSlashCommandFeatureFlag {
|
||||||
|
const NAME: &'static str = "docs-slash-command";
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) struct DocsSlashCommand;
|
pub(crate) struct DocsSlashCommand;
|
||||||
|
|
||||||
impl DocsSlashCommand {
|
impl DocsSlashCommand {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue