Add a SlashCommandResult
type alias (#19633)
This PR adds a new `SlashCommandResult` type alias. We're going to be changing what slash commands can return in order to support streaming, so having this type alias in place will make that switch a bit more neat. Release Notes: - N/A
This commit is contained in:
parent
8bfd27b00b
commit
9c0dba4ce1
21 changed files with 87 additions and 54 deletions
|
@ -1,6 +1,8 @@
|
|||
use super::{diagnostics_command::collect_buffer_diagnostics, SlashCommand, SlashCommandOutput};
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use assistant_slash_command::{AfterCompletion, ArgumentCompletion, SlashCommandOutputSection};
|
||||
use assistant_slash_command::{
|
||||
AfterCompletion, ArgumentCompletion, SlashCommand, SlashCommandOutput,
|
||||
SlashCommandOutputSection, SlashCommandResult,
|
||||
};
|
||||
use fuzzy::PathMatch;
|
||||
use gpui::{AppContext, Model, Task, View, WeakView};
|
||||
use language::{BufferSnapshot, CodeLabel, HighlightId, LineEnding, LspAdapterDelegate};
|
||||
|
@ -16,6 +18,8 @@ use ui::prelude::*;
|
|||
use util::ResultExt;
|
||||
use workspace::Workspace;
|
||||
|
||||
use crate::slash_command::diagnostics_command::collect_buffer_diagnostics;
|
||||
|
||||
pub(crate) struct FileSlashCommand;
|
||||
|
||||
impl FileSlashCommand {
|
||||
|
@ -181,7 +185,7 @@ impl SlashCommand for FileSlashCommand {
|
|||
workspace: WeakView<Workspace>,
|
||||
_delegate: Option<Arc<dyn LspAdapterDelegate>>,
|
||||
cx: &mut WindowContext,
|
||||
) -> Task<Result<SlashCommandOutput>> {
|
||||
) -> Task<SlashCommandResult> {
|
||||
let Some(workspace) = workspace.upgrade() else {
|
||||
return Task::ready(Err(anyhow!("workspace was dropped")));
|
||||
};
|
||||
|
@ -198,7 +202,7 @@ fn collect_files(
|
|||
project: Model<Project>,
|
||||
glob_inputs: &[String],
|
||||
cx: &mut AppContext,
|
||||
) -> Task<Result<SlashCommandOutput>> {
|
||||
) -> Task<SlashCommandResult> {
|
||||
let Ok(matchers) = glob_inputs
|
||||
.into_iter()
|
||||
.map(|glob_input| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue