assistant: Include diagnostics in slash commands by default (#13359)
Include error diagnostics by default for the following slash commands: `/file`, `/tabs`, `/active` Release Notes: - N/A
This commit is contained in:
parent
9bdb154a9b
commit
abb46473c9
4 changed files with 117 additions and 84 deletions
|
@ -1,4 +1,5 @@
|
|||
use super::{
|
||||
diagnostics_command::write_single_file_diagnostics,
|
||||
file_command::{build_entry_output_section, codeblock_fence_for_path},
|
||||
SlashCommand, SlashCommandOutput,
|
||||
};
|
||||
|
@ -77,6 +78,7 @@ impl SlashCommand for TabsSlashCommand {
|
|||
|
||||
let mut sections = Vec::new();
|
||||
let mut text = String::new();
|
||||
let mut has_diagnostics = false;
|
||||
for (full_path, buffer, _) in open_buffers {
|
||||
let section_start_ix = text.len();
|
||||
text.push_str(&codeblock_fence_for_path(full_path.as_deref(), None));
|
||||
|
@ -86,7 +88,14 @@ impl SlashCommand for TabsSlashCommand {
|
|||
if !text.ends_with('\n') {
|
||||
text.push('\n');
|
||||
}
|
||||
writeln!(text, "```\n").unwrap();
|
||||
writeln!(text, "```").unwrap();
|
||||
if write_single_file_diagnostics(&mut text, full_path.as_deref(), &buffer) {
|
||||
has_diagnostics = true;
|
||||
}
|
||||
if !text.ends_with('\n') {
|
||||
text.push('\n');
|
||||
}
|
||||
|
||||
let section_end_ix = text.len() - 1;
|
||||
sections.push(build_entry_output_section(
|
||||
section_start_ix..section_end_ix,
|
||||
|
@ -99,7 +108,7 @@ impl SlashCommand for TabsSlashCommand {
|
|||
Ok(SlashCommandOutput {
|
||||
text,
|
||||
sections,
|
||||
run_commands_in_text: false,
|
||||
run_commands_in_text: has_diagnostics,
|
||||
})
|
||||
}),
|
||||
Err(error) => Task::ready(Err(error)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue