Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Conversation

philipp-spiess
Copy link
Contributor

@philipp-spiess philipp-spiess commented Nov 11, 2022

Closes #44397

This improves the git blame view based on the design input from: https://www.figma.com/file/ecHi31BUCccGtjZsOrNR56/Git-blame-improvements?node-id=1816%3A3628

I made one substantial change from the final Figma: Instead of the zebra-striped background pattern, I decided to implement an earlier revision and use a border to visually distinguish blame hunks. The reason for this has to do with the streaming implementation of git blame that we're currently testing for some customers: In that implementation, chunks are loaded lazily and we do a first render pass with incomplete chunk data. Because of this, we don't know how many chunks appear above a rendered line and thus the zebra calculation is not possible (we don't know if we're on an even or odd chunk). IMO, changing to a border is the easiest way to fix this. We can always change this later though.

Test plan

Light mode Dark mode
Screenshot 2022-12-21 at 16 10 09 Screenshot 2022-12-21 at 16 10 17

I've tested this with the none-CodeMirror view as well. The UI for that is not awesome but it's a reasonable fallback. The next release enables code mirror by default anyways.:

Screenshot Screenshot 2022-12-21 at 16 17 29

App preview:

Check out the client app preview documentation to learn more.

@philipp-spiess philipp-spiess added the needs-design Design requests - add to 'design priorities' project, add a deadline, if possible.. label Nov 11, 2022
@cla-bot cla-bot bot added the cla-signed label Nov 11, 2022
@sg-e2e-regression-test-bob
Copy link

sg-e2e-regression-test-bob commented Nov 11, 2022

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (+0.05 kb) -0.09% (-13.80 kb) 🔽 -0.12% (-13.85 kb) 🔽 0.66% (+5) 🔺

Look at the Statoscope report for a full comparison between the commits 8e8c772 and ef9aa16 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

@philipp-spiess philipp-spiess added the team/code-exploration Issues owned by the Code Exploration team label Nov 16, 2022
@philipp-spiess philipp-spiess removed needs-design Design requests - add to 'design priorities' project, add a deadline, if possible.. blocked labels Dec 21, 2022
@philipp-spiess philipp-spiess requested review from a team December 21, 2022 15:38
@philipp-spiess philipp-spiess self-assigned this Dec 21, 2022
@philipp-spiess philipp-spiess marked this pull request as ready for review December 21, 2022 15:38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhchabran Do we have a list of changes needed before we roll out the git streaming more broadly? Adding support for the user query would be necessary as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@philipp-spiess catching up with GH as I'm back from PTO. It seems that the new code handles this differently, is this comment still relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhchabran Yeah this is still required. With the GraphQL query it's possible to load the user from a git author but with our streaming endpoint this is not included yet. Do you think it would be a lot of work to add this to the JSON payloads?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhchabran @mrnugget I’m unsure about the authz.DefaultSubRepoPermsChecker field here. Do you have any advice on what I should be doing? 😬

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I verified that the other code path to resolve commits use the same thing:

https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/cmd/frontend/graphqlbackend/git_commit.go?L94

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. cc @sourcegraph/iam

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. cc @sourcegraph/iam

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// We can not access the light theme from the view props beacuse we need
// We can not access the light theme from the view props because we need

Copy link
Contributor

@taras-yemets taras-yemets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! These are huge improvements!

@taras-yemets
Copy link
Contributor

I think we should update the 'old' table blob view styling to look similar to the CodeMirror blob: the blame section seems a bit condensed, recency indicators overflow sibling lines, and hunks separators are not visible.

Screenshot 2022-12-21 at 18 08 48

@philipp-spiess
Copy link
Contributor Author

@taras-yemets Yeah I wrote about this in the PR test plan. I don't want to invest too much into the old view given that Code Mirror is going to be the default with the same release as this change anyway. Does this make sense?

@taras-yemets
Copy link
Contributor

I don't want to invest too much into the old view given that Code Mirror is going to be the default with the same release as this change anyway. Does this make sense?

@philipp-spiess, I somehow missed it, sorry.

@philipp-spiess
Copy link
Contributor Author

@taras-yemets No worries! What are your thought? I assume that maybe a few users could be left on the old view until we remove the code in the following release. For them the experience would be subpar but also not horribly broken. And they can always enable CodeMirror to fix it and get a lot of other improvements like faster rendering

@taras-yemets
Copy link
Contributor

Now that we have these awesome hunks separators I think it would be nice to highlight the line code content when the corresponding blame hunk is hovered (even if it's not the first line of the hunk) similar to JetBrains and VSCode. What do you think?

gif2

@taras-yemets
Copy link
Contributor

I assume that maybe a few users could be left on the old view until we remove the code in the following release. For them the experience would be subpar but also not horribly broken. And they can always enable CodeMirror to fix it and get a lot of other improvements like faster rendering

CodeMirror blob is enabled by default on dotcom and s2 instances and would likely be the default in the upcoming release. With that said, I think we can even not ship recency and hunks separators for the table code view (unless it adds too much code overhead in reused BlameDecoration component).

@philipp-spiess
Copy link
Contributor Author

I think we should update the 'old' table blob view styling to look similar to the CodeMirror blob: the blame section seems a bit condensed, recency indicators overflow sibling lines, and hunks separators are not visible.

I fixed the line height at least, that way it doesn't feel broken anymore

Now that we have these awesome hunks separators I think it would be nice to highlight the line code content when the corresponding blame hunk is hovered (even if it's not the first line of the hunk) similar to JetBrains and VSCode. What do you think?

Not sure I understand (the GIF is very small 😢) but yeah the hover area feels weirder now. Let's do this as a follow-up though?

@taras-yemets
Copy link
Contributor

Not sure I understand (the GIF is very small 😢) but yeah the hover area feels weirder now.

Screen.Recording.2022-12-21.at.18.24.33.mov

Let's do this as a follow-up though?

Makes sense 👍🏻

@philipp-spiess
Copy link
Contributor Author

@taras-yemets Much better! This is now with the legacy blob view:

Screenshot 2022-12-21 at 17 48 46

Comment on lines +5 to +6
// The values are sampled from the following function:
// y=0.005*1.7^x
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠

Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally. It looks awesome!

@philipp-spiess
Copy link
Contributor Author

I noticed a stupid bug with the old blob view and the top spacer when blame is enabled 😢

Screenshot 2022-12-22 at 13 48 40

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-signed team/code-exploration Issues owned by the Code Exploration team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Git blame improvements
6 participants