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

Position inline-git-blame information at column count #10555

Closed
1 task done
jansol opened this issue Apr 15, 2024 · 7 comments
Closed
1 task done

Position inline-git-blame information at column count #10555

jansol opened this issue Apr 15, 2024 · 7 comments
Labels
enhancement [core label] git blame git Git integration feedback good first issue Issue suitable for first-time contributors

Comments

@jansol
Copy link
Contributor

jansol commented Apr 15, 2024

Check for existing issues

  • Completed

Describe the feature

This is more of a "UI exploration" thing, I'm not sure yet if it's actually a good idea.

How about an option to constrain the inline git blame to a certain column position? I would consider setting it to never appear to the left of the first line wrap guide (80 cols in my config).

The motivation for this is to avoid causing a seemingly solid block of text when the cursor is on a short line between long lines (e.g. a paragraph break in a long comment)

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

No response

@jansol jansol added admin read Pending admin review enhancement [core label] triage Maintainer needs to classify the issue labels Apr 15, 2024
@mrnugget mrnugget changed the title Inline git blame positioning Position inline-git-blame information at column count Apr 15, 2024
@mrnugget mrnugget added the good first issue Issue suitable for first-time contributors label Apr 15, 2024
@mrnugget
Copy link
Member

That should be relatively easy.

  1. Define a setting for this
  2. Use min(line_width, settings.inline_blame_column*em_width) here:
    content_origin.x + line_width + (em_width * INLINE_BLAME_PADDING_EM_WIDTHS)

@jansol
Copy link
Contributor Author

jansol commented Apr 15, 2024

Should be max, not min, but that does indeed do exactly what I described. Most of the work would be adding the setting.

An interesting extension of this would be to snap to the lowest indent guide that is > line length + padding.

@JosephTLyons JosephTLyons added git Git integration feedback git blame and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Apr 15, 2024
@jansol
Copy link
Contributor Author

jansol commented Apr 15, 2024

Ah, except that logic makes it go out of view if the line is soft-wrapped (e.g. due to inlay hints making it longer than desired). In that case the blame should probably be moved to the last line of the soft-wrapped part.

@mrnugget
Copy link
Member

Ah, except that logic makes it go out of view if the line is soft-wrapped (e.g. due to inlay hints making it longer than desired). In that case the blame should probably be moved to the last line of the soft-wrapped part.

In #10600 I just added support for soft-wrapped lines (it was just broken before). It's now displayed next to each wrapped line, which I think makes sense when you think about the "soft_wrap": "preferred_line_length" case, where each line could be cut off at 80 cols.

@hshreekar
Copy link
Contributor

Hey, can i work on this ?
I am new to contributing to Open Source, so would be helpful if there was a manifest of what to do, i believe all the git blame functionality is in the blame.rs file of git crate?

@mrnugget
Copy link
Member

@hshreekar sure, I linked to the code that needs to be edited above.

  1. Add a git.inline_blame.min_column setting to ProjectSettings (an Option<u32>?)
  2. In the code that I linked above, access the project settings
  3. Use max(line_width, git.inline_blame.min_column) if min_column is set

mrnugget added a commit that referenced this issue Apr 18, 2024
Release Notes:

- Added a setting to determine the minimum column where the inline blame
information is shown. Example: `{{"git": {"inline_blame": {"min_column":
80}}}` ([#10555](#10555)).

Demo Video:


https://github.com/zed-industries/zed/assets/1185253/61343dbe-9002-4bd1-b0d4-403f8da79050

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
@JosephTLyons
Copy link
Contributor

This landed in v0.133.0-pre today. Closing this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement [core label] git blame git Git integration feedback good first issue Issue suitable for first-time contributors
Projects
None yet
Development

No branches or pull requests

4 participants