assistant: Make including warnings for the diagnostic command more discoverable (#13323)
This makes the `--include-warnings` argument more discoverable <img width="651" alt="image" src="https://github.com/zed-industries/zed/assets/53836821/02d32496-ad7a-4670-85ce-eda945c0f1c2"> Release Notes: - N/A
This commit is contained in:
parent
d5b0df6efa
commit
5a6c55149a
3 changed files with 27 additions and 12 deletions
|
@ -3,8 +3,8 @@ use anyhow::Result;
|
||||||
pub use assistant_slash_command::{SlashCommand, SlashCommandOutput, SlashCommandRegistry};
|
pub use assistant_slash_command::{SlashCommand, SlashCommandOutput, SlashCommandRegistry};
|
||||||
use editor::{CompletionProvider, Editor};
|
use editor::{CompletionProvider, Editor};
|
||||||
use fuzzy::{match_strings, StringMatchCandidate};
|
use fuzzy::{match_strings, StringMatchCandidate};
|
||||||
use gpui::{Model, Task, ViewContext, WeakView, WindowContext};
|
use gpui::{AppContext, Model, Task, ViewContext, WeakView, WindowContext};
|
||||||
use language::{Anchor, Buffer, CodeLabel, Documentation, LanguageServerId, ToPoint};
|
use language::{Anchor, Buffer, CodeLabel, Documentation, HighlightId, LanguageServerId, ToPoint};
|
||||||
use parking_lot::{Mutex, RwLock};
|
use parking_lot::{Mutex, RwLock};
|
||||||
use rope::Point;
|
use rope::Point;
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -14,6 +14,7 @@ use std::{
|
||||||
Arc,
|
Arc,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
use ui::ActiveTheme;
|
||||||
use workspace::Workspace;
|
use workspace::Workspace;
|
||||||
|
|
||||||
pub mod active_command;
|
pub mod active_command;
|
||||||
|
@ -347,3 +348,19 @@ impl SlashCommandLine {
|
||||||
call
|
call
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn create_label_for_command(
|
||||||
|
command_name: &str,
|
||||||
|
arguments: &[&str],
|
||||||
|
cx: &AppContext,
|
||||||
|
) -> CodeLabel {
|
||||||
|
let mut label = CodeLabel::default();
|
||||||
|
label.push_str(command_name, None);
|
||||||
|
label.push_str(" ", None);
|
||||||
|
label.push_str(
|
||||||
|
&arguments.join(" "),
|
||||||
|
cx.theme().syntax().highlight_id("comment").map(HighlightId),
|
||||||
|
);
|
||||||
|
label.filter_range = 0..command_name.len();
|
||||||
|
label
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use super::{SlashCommand, SlashCommandOutput};
|
use super::{create_label_for_command, SlashCommand, SlashCommandOutput};
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use assistant_slash_command::SlashCommandOutputSection;
|
use assistant_slash_command::SlashCommandOutputSection;
|
||||||
use fuzzy::{PathMatch, StringMatchCandidate};
|
use fuzzy::{PathMatch, StringMatchCandidate};
|
||||||
|
@ -85,6 +85,10 @@ impl SlashCommand for DiagnosticsCommand {
|
||||||
"diagnostics".into()
|
"diagnostics".into()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn label(&self, cx: &AppContext) -> language::CodeLabel {
|
||||||
|
create_label_for_command("diagnostics", &[INCLUDE_WARNINGS_ARGUMENT], cx)
|
||||||
|
}
|
||||||
|
|
||||||
fn description(&self) -> String {
|
fn description(&self) -> String {
|
||||||
"Insert diagnostics".into()
|
"Insert diagnostics".into()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
use super::{
|
use super::{
|
||||||
|
create_label_for_command,
|
||||||
file_command::{build_entry_output_section, codeblock_fence_for_path},
|
file_command::{build_entry_output_section, codeblock_fence_for_path},
|
||||||
SlashCommand, SlashCommandOutput,
|
SlashCommand, SlashCommandOutput,
|
||||||
};
|
};
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use assistant_slash_command::SlashCommandOutputSection;
|
use assistant_slash_command::SlashCommandOutputSection;
|
||||||
use gpui::{AppContext, Task, WeakView};
|
use gpui::{AppContext, Task, WeakView};
|
||||||
use language::{CodeLabel, HighlightId, LineEnding, LspAdapterDelegate};
|
use language::{CodeLabel, LineEnding, LspAdapterDelegate};
|
||||||
use semantic_index::SemanticIndex;
|
use semantic_index::SemanticIndex;
|
||||||
use std::{
|
use std::{
|
||||||
fmt::Write,
|
fmt::Write,
|
||||||
|
@ -24,14 +25,7 @@ impl SlashCommand for SearchSlashCommand {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn label(&self, cx: &AppContext) -> CodeLabel {
|
fn label(&self, cx: &AppContext) -> CodeLabel {
|
||||||
let mut label = CodeLabel::default();
|
create_label_for_command("search", &["--n"], cx)
|
||||||
label.push_str("search ", None);
|
|
||||||
label.push_str(
|
|
||||||
"--n",
|
|
||||||
cx.theme().syntax().highlight_id("comment").map(HighlightId),
|
|
||||||
);
|
|
||||||
label.filter_range = 0.."search".len();
|
|
||||||
label
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn description(&self) -> String {
|
fn description(&self) -> String {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue