Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File finder: git diff links (Ignore a/ and b/ prefix) #15081

Open
1 task done
DragonDev1906 opened this issue Jul 24, 2024 · 1 comment
Open
1 task done

File finder: git diff links (Ignore a/ and b/ prefix) #15081

DragonDev1906 opened this issue Jul 24, 2024 · 1 comment
Labels
enhancement [core label] git Git integration feedback navigation Feedback for workspace navigation, breadcrumbs, definitions, files, panels, etc terminal Feedback for terminal integration, shell commands, etc

Comments

@DragonDev1906
Copy link

Check for existing issues

  • Completed

Describe the feature

I often use git diff in the terminal (outside of Zed), notice a small mistake (usually a dbg!(...), println!(...), similar or code I've commented out but not deleted) and need to go back to Zed and jump to this file.

When copying the file path from the terminal (double click to select the entire path) it includes the a/ or b/: a/path/to/my/file.rs. Unfortunately this means that you have to manually remove the a/ or b/ prefix for Zed to find the file.

Although this is not an issue from/with/by Zed, it would be amazing if the file finder would recognize this pattern/prefix and remove the a/ and b/ prefix automatically.

--- a/path/to/my/file.rs
+++ b/path/to/my/file.rs

That way the following three would yield identical results:

path/to/my/file.rs
a/path/to/my/file.rs
b/path/to/my/file.rs

I can only see two downsides to this:

  • A tiny amount of additional complexity in the file finder, which now has to strip the prefix in addition to splitting the file name from the line number (a one-liner)
  • A few queries may be less accurate, for example someone using a/part_of_filename would now list everything with part_of_filename instead of only part_of_filename that are in a folder with the letter a.

Overall, I think the first downside is small enough and the second downside is negligible.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@DragonDev1906 DragonDev1906 added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Jul 24, 2024
@notpeter notpeter added terminal Feedback for terminal integration, shell commands, etc navigation Feedback for workspace navigation, breadcrumbs, definitions, files, panels, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Jul 28, 2024
@notpeter notpeter changed the title Ignore a/ and b/ prefix (from git diff) in file finder clickable file links from git diff in terminal (Ignore a/ and b/ prefix) Jul 28, 2024
@notpeter notpeter added the git Git integration feedback label Jul 28, 2024
@watsoncj
Copy link
Contributor

watsoncj commented Sep 5, 2024

The bits to ignore the a/ and b/ prefix is available in #17446.

Maybe a stretch goal, but it would great to pull the location from the diff and jump the buffer to the appropriate location.

Example:

diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rs
index 8fc235523e..1410d203ca 100644
--- a/crates/terminal_view/src/terminal_view.rs
+++ b/crates/terminal_view/src/terminal_view.rs
@@ -58,6 +58,8 @@ const REGEX_SPECIAL_CHARS: &[char] = &[

@DragonDev1906 DragonDev1906 changed the title clickable file links from git diff in terminal (Ignore a/ and b/ prefix) File finder: git diff links (Ignore a/ and b/ prefix) Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] git Git integration feedback navigation Feedback for workspace navigation, breadcrumbs, definitions, files, panels, etc terminal Feedback for terminal integration, shell commands, etc
Projects
None yet
Development

No branches or pull requests

3 participants