Inline terminal assistant v2 (#21888)
Follow-up to https://github.com/zed-industries/zed/pull/21828 to add it to the terminal as well. https://github.com/user-attachments/assets/505d1443-4081-4dd8-9725-17d85532f52d As with the previous PR, there's plenty of code duplication here; the plan is to do more code sharing in separate PRs! Release Notes: - N/A
This commit is contained in:
parent
77d066200a
commit
bcf8a2f9fc
6 changed files with 1100 additions and 10 deletions
|
@ -2,6 +2,7 @@ use crate::{
|
|||
assistant_settings::AssistantSettings,
|
||||
prompts::PromptBuilder,
|
||||
streaming_diff::{CharOperation, LineDiff, LineOperation, StreamingDiff},
|
||||
terminal_inline_assistant::TerminalInlineAssistant,
|
||||
CycleNextInlineAssist, CyclePreviousInlineAssist, ToggleInlineAssist,
|
||||
};
|
||||
use anyhow::{Context as _, Result};
|
||||
|
@ -207,16 +208,16 @@ impl InlineAssistant {
|
|||
.map_or(false, |provider| provider.is_authenticated(cx))
|
||||
};
|
||||
|
||||
let handle_assist = |cx: &mut ViewContext<Workspace>| {
|
||||
match inline_assist_target {
|
||||
InlineAssistTarget::Editor(active_editor) => {
|
||||
InlineAssistant::update_global(cx, |assistant, cx| {
|
||||
assistant.assist(&active_editor, Some(cx.view().downgrade()), cx)
|
||||
})
|
||||
}
|
||||
InlineAssistTarget::Terminal(_active_terminal) => {
|
||||
// TODO show the terminal inline assistant
|
||||
}
|
||||
let handle_assist = |cx: &mut ViewContext<Workspace>| match inline_assist_target {
|
||||
InlineAssistTarget::Editor(active_editor) => {
|
||||
InlineAssistant::update_global(cx, |assistant, cx| {
|
||||
assistant.assist(&active_editor, Some(cx.view().downgrade()), cx)
|
||||
})
|
||||
}
|
||||
InlineAssistTarget::Terminal(active_terminal) => {
|
||||
TerminalInlineAssistant::update_global(cx, |assistant, cx| {
|
||||
assistant.assist(&active_terminal, Some(cx.view().downgrade()), cx)
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue