Centralize the CopyPath
and CopyRelativePath
actions to zed_actions
(#24836)
I spent an hour with @marcospb19 this morning debugging an issue with adding `Copy Path` and `Copy Relative Path` actions to the editor context menu. Turned out that the problem was using `workspace::CopyPath` in the menu and `editor::CopyPath` in the action handler. This is an easy mistake to make, so let's fix it for everyone. Release Notes: - N/A
This commit is contained in:
parent
28c667a3c7
commit
5d26ce14d7
13 changed files with 84 additions and 31 deletions
|
@ -267,9 +267,7 @@ gpui::actions!(
|
|||
CopyHighlightJson,
|
||||
CopyFileName,
|
||||
CopyFileNameWithoutExtension,
|
||||
CopyPath,
|
||||
CopyPermalinkToLine,
|
||||
CopyRelativePath,
|
||||
Cut,
|
||||
CutToEndOfLine,
|
||||
Delete,
|
||||
|
|
|
@ -13106,7 +13106,12 @@ impl Editor {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn copy_path(&mut self, _: &CopyPath, _window: &mut Window, cx: &mut Context<Self>) {
|
||||
pub fn copy_path(
|
||||
&mut self,
|
||||
_: &zed_actions::workspace::CopyPath,
|
||||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
if let Some(path) = self.target_file_abs_path(cx) {
|
||||
if let Some(path) = path.to_str() {
|
||||
cx.write_to_clipboard(ClipboardItem::new_string(path.to_string()));
|
||||
|
@ -13116,7 +13121,7 @@ impl Editor {
|
|||
|
||||
pub fn copy_relative_path(
|
||||
&mut self,
|
||||
_: &CopyRelativePath,
|
||||
_: &zed_actions::workspace::CopyRelativePath,
|
||||
_window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue