-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Show the number of lines changed per file in working file tree view #4015
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great. I support enabling this by default. I'm even open to not making it configurable. I've asked on twitter if anybody would want to disable it: https://x.com/DuffieldJesse/status/1855137711667167267
I've left some comments.
Keen to get your thoughts on this @stefanhaller @mark2185
@@ -100,6 +155,16 @@ type FileStatus struct { | |||
PreviousName string | |||
} | |||
|
|||
func (fileLoader *FileLoader) gitDiffNumStat() (string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three things:
- Just confirming that this can't be bundled into the
git status
command? - How expensive is this command to run? If it's expensive, we may need to run it asynchronously
- I've noticed that this doesn't include untracked files. Is there a way to include those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I did research on this and could not find any way to use
git status
for this. -
I tested this for 18 files changed with about 6000 insertions and 3000 deletions:
- on my M1 Pro the
git diff --numstat
command takes 62 milliseconds. - in comparison: the
git status
command takes 46 milliseconds.
What do you think performance-wise? Is it fast enough to run synchronously?
- on my M1 Pro the
-
According to my research it is not possible to include untracked files in a
git diff
command. I don't think it is super important to include these, but it would probably be possible to determine the number of added lines another way for untracked files.
When I first briefly looked at it two weeks ago, my gut reaction was:
I haven't had time to come back to it since then, and have a closer look or even try it out myself, but currently my feeling is that I would keep it off by default. I'll see if I find some time this weekend to try it out, maybe this will change my mind. 😄 |
Fantastic addition! Maybe also aggregate the counts for collapsed folders? To address the concern regarding UI noise: maybe on by default with an option to disable it? OR even better, a keybinding to toggle the visibility. VS Code has keybindings to toggle inlay-hints and code-lenses, and it's great to quickly show/hide extra-info on demand via a single keystroke. |
I kinda agree with Stefan, I think I'd keep it off for the |
I tried it for a bit now, and I have to say that I (personally) don't like it. The line changes information doesn't provide any value for me, I don't need to see it; but it makes the view considerably more noisy, so I'd definitely turn it off. So it does need to be configurable. As to whether the option should be on or off by default, I don't have a strong opinion; I'd tend to make it off by default, like we do for the base branch divergence information in the branches view. Also, there's a visual appearance problem related to the colors: the green/red coloring looks great for files that are either unstaged (white) or partially staged (yellow), but for staged files (green) there's not enough visual distinction between the file name and the |
Let's make it off-by-default. See this twitter thread for some user feedback.
I think this is a minor thing which doesn't need fixing. |
Alright, let's do it that way. I also feel there are valid points for keeping it off by default. I appreciate your input! I'll incorporate your feedback when I find the time. Another point: @mark2185 mentioned the feature would be useful when focusing on a commit. This is not part of my current implementation. Should I add it? |
I think this would be good, I could see this as being more useful than in the Files panel. I think it should be a separate config option, people might want to turn it on for Commit Files but off for Files. And it could be done in a separate PR, of course. |
fde21da
to
913d026
Compare
Implements Issue Ability to see # of line changes in the diff window #3643
Adds the number of line changes to the end of each file line in the Files view.
Also adds the possibility for the user to enable and disable this feature through the UserConfig.
go generate ./...
)