From 2300f40cd987bdb3602769d312786eb4118d711c Mon Sep 17 00:00:00 2001
From: Danilo Leal <67129314+danilo-leal@users.noreply.github.com>
Date: Mon, 2 Dec 2024 09:28:46 -0300
Subject: [PATCH] Add consistent placeholder text for terminal inline assist
(#21398)
Ensuring it is consistent with the buffer inline assistant. Just thought
of not having "Transform" here as that felt it made less sense for
terminal-related prompts, where arguably more frequently, one would be
suggesting for actual commands rather than code transformation.
Release Notes:
- N/A
---
crates/assistant/src/terminal_inline_assistant.rs | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/crates/assistant/src/terminal_inline_assistant.rs b/crates/assistant/src/terminal_inline_assistant.rs
index a5424a8d7e2d2bddaebda129ac4d4cbd57089e5e..d60a556cf06cf380f23b9e70f96744ab93bdd334 100644
--- a/crates/assistant/src/terminal_inline_assistant.rs
+++ b/crates/assistant/src/terminal_inline_assistant.rs
@@ -32,7 +32,7 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
use terminal::Terminal;
use terminal_view::TerminalView;
use theme::ThemeSettings;
-use ui::{prelude::*, IconButtonShape, Tooltip};
+use ui::{prelude::*, text_for_action, IconButtonShape, Tooltip};
use util::ResultExt;
use workspace::{notifications::NotificationId, Toast, Workspace};
@@ -704,7 +704,7 @@ impl PromptEditor {
cx,
);
editor.set_soft_wrap_mode(language::language_settings::SoftWrap::EditorWidth, cx);
- editor.set_placeholder_text("Add a prompt…", cx);
+ editor.set_placeholder_text(Self::placeholder_text(cx), cx);
editor
});
@@ -737,6 +737,14 @@ impl PromptEditor {
this
}
+ fn placeholder_text(cx: &WindowContext) -> String {
+ let context_keybinding = text_for_action(&crate::ToggleFocus, cx)
+ .map(|keybinding| format!(" • {keybinding} for context"))
+ .unwrap_or_default();
+
+ format!("Generate…{context_keybinding} • ↓↑ for history")
+ }
+
fn subscribe_to_editor(&mut self, cx: &mut ViewContext) {
self.editor_subscriptions.clear();
self.editor_subscriptions