Add "Copy current path" command palette action#13148
Conversation
Adds a "Copy current path" entry to the command palette that copies a path based on the focused pane: the open file's display path when the rendered file viewer (FilePane) is focused, otherwise the current session's working directory when a terminal/block is focused. Works whether or not the file viewer is open. Extends the file-viewer right-click "Copy file path" item (warpdotdev#13145 / warpdotdev#8974) to the command palette. - New WorkspaceAction::CopyCurrentPath (no-op when no path resolves), registered as an always-available "Copy current path" binding. - PaneGroup::path_from_focused_pane resolves the path, mirroring the existing selected_text_from_focused_pane sibling. - Integration test covering the terminal-pwd case. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @elviskahoro on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
Every PR must be linked to a same-repo issue before Oz can review it. Next step: open or find a same-repo issue describing this change, then link it to this PR by adding See the contribution guidelines for the full readiness model. Powered by Oz |
There was a problem hiding this comment.
Every PR must be linked to a same-repo issue before Oz can review it.
Next step: open or find a same-repo issue describing this change, then link it to this PR by adding Closes #123 to the PR description (or using the "Development" sidebar on GitHub). A maintainer will mark the issue ready-to-implement when it is ready. Once it is marked, comment /oz-review to re-trigger review.
See the contribution guidelines for the full readiness model.
Powered by Oz
|
@bholmesdev I did the CLA check! lmk if this needs feature flag |
Closes #13149. Extends #13145 — adds the command-palette half of #8974.
What
Adds a "Copy current path" entry to the command palette that copies a path based on the focused pane, so the path can be copied without right-clicking and whether or not the file viewer is open:
FilePane→FileNotebookView) → copies the open file'sdisplay_path()(works for local and remote/SSH).This complements the right-click "Copy file path" item added to the file viewer in #13145.
How
app/src/workspace/action.rs— newWorkspaceAction::CopyCurrentPath(added to theshould_save_app_state_on_action=> falselist, since copying a path doesn't mutate app state).app/src/pane_group/mod.rs—PaneGroup::path_from_focused_pane, mirroring the existingselected_text_from_focused_panesibling. Resolves a focusedFilePane→ filedisplay_path(), otherwisefocused_session_view().pwd()(falling back todisplay_working_directory, matching the existing tab "Copy working directory" item). Placed here so nolocal_fscfg-gating is needed (FilePaneis unconditionally available in this module).app/src/workspace/mod.rs— registers the always-availableworkspace:copy_current_pathbinding (palette label "Copy current path",id!("Workspace")predicate). No-op when nothing resolves.app/src/workspace/view.rs—Workspace::handle_actionarm that writes the resolved path to the clipboard.crates/integration/...— integration testtest_copy_current_path_copies_terminal_pwd(cd into a known dir, run the palette action, assert the clipboard equals the focused terminal's pwd), registered in the three usual places.Scope: the rendered file viewer (
FilePane) is covered; the code editor pane (CodePane) is intentionally out of scope.Testing
cargo check -p warp --lib→ passes, no new warnings.cargo check -p integration --all-targets→ passes (new test compiles and is registered).rustfmt --checkon all touched files → clean.path()/display_path()accessors already unit-tested in Add "Copy file path" to file viewer pane right-click menu #13145.