Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/pane_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,8 @@ pub enum Event {
OpenEnvironmentManagementPane,
OpenFilesPalette {
source: PaletteSource,
/// When set, opens the Files palette pre-filled with this query.
initial_query: Option<String>,
},
ToggleLeftPanel {
target_view: LeftPanelTargetView,
Expand Down
10 changes: 7 additions & 3 deletions app/src/pane_group/pane/terminal_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1375,9 +1375,13 @@ fn handle_terminal_view_event(
Event::OpenMCPSettingsPage { page } => {
ctx.emit(pane_group::Event::OpenMCPSettingsPage { page: *page });
}
Event::OpenFilesPalette { source } => {
ctx.emit(pane_group::Event::OpenFilesPalette { source: *source })
}
Event::OpenFilesPalette {
source,
initial_query,
} => ctx.emit(pane_group::Event::OpenFilesPalette {
source: *source,
initial_query: initial_query.clone(),
}),
Event::OpenAddRulePane => {
ctx.emit(crate::pane_group::Event::OpenAddRulePane);
}
Expand Down
6 changes: 5 additions & 1 deletion app/src/server/telemetry/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ pub enum CommandXRayTrigger {
pub enum PaletteSource {
PrefixChange,
Keybinding,
CtrlTab { shift_pressed_initially: bool },
CtrlTab {
shift_pressed_initially: bool,
},
WarpDrive,
QuitModal,
LogOutModal,
Expand All @@ -445,6 +447,8 @@ pub enum PaletteSource {
PaneHeader,
AgentTip,
TitleBarSearchBar,
/// Opened by clicking an ambiguous file link (multiple repo matches) in CLI agent output.
FileLink,
}

#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
Expand Down
44 changes: 40 additions & 4 deletions app/src/terminal/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,9 @@ pub enum Event {
OpenEnvironmentManagementPane,
OpenFilesPalette {
source: PaletteSource,
/// When set, opens the Files palette pre-filled with this query (used by ambiguous
/// CLI-agent file links so the user can pick among multiple matches).
initial_query: Option<String>,
},
#[cfg(feature = "local_fs")]
OpenFileWithTarget {
Expand Down Expand Up @@ -16288,6 +16291,14 @@ impl TerminalView {
})
.unwrap_or_default()
}
#[cfg(feature = "local_fs")]
GridHighlightedLink::AmbiguousFile(_) => {
vec![MenuItemFields::new("Open file…")
.with_on_select_action(TerminalAction::OpenGridLink(
highlighted_link.clone(),
))
.into_item()]
}
}
}
(
Expand Down Expand Up @@ -18010,6 +18021,22 @@ impl TerminalView {
});
}

/// Opens the command-palette Files mode pre-filled with `query`. Used when a CLI-agent file
/// reference matched multiple repo files, so the user disambiguates rather than us guessing.
#[cfg(feature = "local_fs")]
fn open_ambiguous_file_link(&mut self, query: String, ctx: &mut ViewContext<Self>) {
// Dismiss the grid tooltip explicitly: unlike opening a single file (which switches away
// from the terminal), opening the palette leaves the terminal on screen, so a lingering
// tooltip would re-render detached from its now-cleared link anchor. The tooltip-click path
// already dismisses; this also covers the Cmd+Click path.
self.dismiss_tooltips(ctx);
ctx.notify();
ctx.emit(Event::OpenFilesPalette {
source: PaletteSource::FileLink,
initial_query: Some(query),
});
}

#[cfg(feature = "local_fs")]
fn open_file_path_with_target(
&mut self,
Expand Down Expand Up @@ -18051,6 +18078,11 @@ impl TerminalView {
self.open_file_path(path, link.line_and_column_num, ctx);
}
}
#[cfg(feature = "local_fs")]
GridHighlightedLink::AmbiguousFile(link) if link.contains(position) => {
let query = link.get_inner().query.clone();
self.open_ambiguous_file_link(query, ctx);
}
GridHighlightedLink::Url(url) if url.contains(position) => {
let model = self.model.lock();
ctx.notify();
Expand Down Expand Up @@ -21199,9 +21231,10 @@ impl TerminalView {
InputEvent::OpenEnvironmentManagementPane => {
self.open_environment_management_pane(ctx);
}
InputEvent::OpenFilesPalette { source } => {
ctx.emit(Event::OpenFilesPalette { source: *source })
}
InputEvent::OpenFilesPalette { source } => ctx.emit(Event::OpenFilesPalette {
source: *source,
initial_query: None,
}),
InputEvent::TryHandlePassiveCodeDiff(action) => {
self.resolve_prompt_suggestion_diff(action.clone(), ctx);
}
Expand Down Expand Up @@ -26692,7 +26725,10 @@ impl TypedActionView for TerminalView {
PickRepoToOpen => {
ctx.dispatch_typed_action(&WorkspaceAction::OpenRepository { path: None });
}
OpenFilesPalette { source } => ctx.emit(Event::OpenFilesPalette { source: *source }),
OpenFilesPalette { source } => ctx.emit(Event::OpenFilesPalette {
source: *source,
initial_query: None,
}),
DismissCodeToolbeltTooltip => {
CodeSettings::handle(ctx).update(ctx, |settings, ctx| {
if let Err(e) = settings
Expand Down
Loading