From 47174cea50017be0f200875cc250c9a68b78d590 Mon Sep 17 00:00:00 2001 From: Stefan <5tefan@users.noreply.github.com> Date: Thu, 20 Jun 2024 01:46:49 -0600 Subject: [PATCH] Add mouse context action to copy permalink (#13247) Screenshot 2024-06-19 at 00 24 21 Selecting the item results in the following link https://github.com/zed-industries/zed/blob/a8c19ab8958a932fc9b7b66e8a0659bf3e3ebcc2/crates/assets/Cargo.toml#L12 for me. ## Summary Switching from PyCharm, my number one most missed feature is "Copy Github link" provided by the Gitlink plugin (https://plugins.jetbrains.com/plugin/8183-gitlink / https://github.com/ben-gibson/GitLink). I use this a lot to quickly send code pointers to teammates. While digging around, I found that this is basically already implemented, but wasn't able to find this action exposed anywhere in the UI. https://github.com/zed-industries/zed/blob/a8c19ab8958a932fc9b7b66e8a0659bf3e3ebcc2/crates/editor/src/editor.rs#L10343-L10367 Release Notes: - Added mouse context action to copy permalink to line --- crates/editor/src/mouse_context_menu.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/editor/src/mouse_context_menu.rs b/crates/editor/src/mouse_context_menu.rs index 09cefc0de2..666303d924 100644 --- a/crates/editor/src/mouse_context_menu.rs +++ b/crates/editor/src/mouse_context_menu.rs @@ -1,7 +1,7 @@ use crate::{ - Copy, Cut, DisplayPoint, Editor, EditorMode, FindAllReferences, GoToDefinition, - GoToImplementation, GoToTypeDefinition, Paste, Rename, RevealInFinder, SelectMode, - ToggleCodeActions, + Copy, CopyPermalinkToLine, Cut, DisplayPoint, Editor, EditorMode, FindAllReferences, + GoToDefinition, GoToImplementation, GoToTypeDefinition, Paste, Rename, RevealInFinder, + SelectMode, ToggleCodeActions, }; use gpui::{DismissEvent, Pixels, Point, Subscription, View, ViewContext}; use workspace::OpenInTerminal; @@ -91,7 +91,8 @@ pub fn deploy_context_menu( .action("Paste", Box::new(Paste)) .separator() .action("Reveal in Finder", Box::new(RevealInFinder)) - .action("Open in Terminal", Box::new(OpenInTerminal)); + .action("Open in Terminal", Box::new(OpenInTerminal)) + .action("Copy Permalink", Box::new(CopyPermalinkToLine)); match focus { Some(focus) => builder.context(focus), None => builder,