Skip to content

Commit 2300f40

Browse files
authored
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. <img width="700" alt="Screenshot 2024-12-02 at 09 11 00" src="https://github.com/user-attachments/assets/ad96d03e-0366-46e8-8056-581066712d59"> Release Notes: - N/A
1 parent dacd919 commit 2300f40

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

crates/assistant/src/terminal_inline_assistant.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use telemetry_events::{AssistantEvent, AssistantKind, AssistantPhase};
3232
use terminal::Terminal;
3333
use terminal_view::TerminalView;
3434
use theme::ThemeSettings;
35-
use ui::{prelude::*, IconButtonShape, Tooltip};
35+
use ui::{prelude::*, text_for_action, IconButtonShape, Tooltip};
3636
use util::ResultExt;
3737
use workspace::{notifications::NotificationId, Toast, Workspace};
3838

@@ -704,7 +704,7 @@ impl PromptEditor {
704704
cx,
705705
);
706706
editor.set_soft_wrap_mode(language::language_settings::SoftWrap::EditorWidth, cx);
707-
editor.set_placeholder_text("Add a prompt…", cx);
707+
editor.set_placeholder_text(Self::placeholder_text(cx), cx);
708708
editor
709709
});
710710

@@ -737,6 +737,14 @@ impl PromptEditor {
737737
this
738738
}
739739

740+
fn placeholder_text(cx: &WindowContext) -> String {
741+
let context_keybinding = text_for_action(&crate::ToggleFocus, cx)
742+
.map(|keybinding| format!(" • {keybinding} for context"))
743+
.unwrap_or_default();
744+
745+
format!("Generate…{context_keybinding} • ↓↑ for history")
746+
}
747+
740748
fn subscribe_to_editor(&mut self, cx: &mut ViewContext<Self>) {
741749
self.editor_subscriptions.clear();
742750
self.editor_subscriptions

0 commit comments

Comments
 (0)