-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Enhance branch display #260
Conversation
5a600ce
to
6e5403a
Compare
c9fe1fb
to
360bf2e
Compare
- Add current getter method to BranchNode - Implment a recursive findCurrent method on BranchFolderNode
c5ace7d
to
34172e4
Compare
@eamodio I think it's ready for review 😄 Ping me if any change is needed. |
@Yukaii Awesome -- I'm starting to look at this. But first can you adapt this to target the |
@eamodio I've merged the changes from develop branch 😸 |
"tree", | ||
"mix-tree" | ||
], | ||
"description": "Specifies how the `Branches` view will display branches\n `list` - display all branches \n`tree` - organize branch as folder if branch name contains slashes \"\/\"\n `mix-tree` - display branch folders along with normal branch alphabetically", |
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.
Any objection to getting rid of mix-tree
and just having tree
behave this way (i.e. sorted naturally)?
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.
Or if you'd like to keep the feature, can we change it to a different setting?
Like gitlens.gitExplorer.branches.sort
= 'alphabetic' | 'foldersFirst' | 'foldersLast'
or
gitlens.gitExplorer.branches.folderGrouping
= 'none' | 'start' | 'end'
?
Thoughts? (I think I'm leaning towards the latter -- as it is more explicit than just sort)
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 think having only two options (list
and tree
) is fine and simpler for user too, actually current tree sort implementation (not the mix-tree
one) calculates more. It runs a recursive function, marking the parent folder as current (BranchFolderNode#findCurrent
)
If you think it's okay, I can drop those commits 😄
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.
Ok let's drop it and just have the 2 options. Thanks!
if (this.explorer.config.branches.layout === ExplorerBranchesLayout.List) { | ||
return branchName; | ||
} else { | ||
return !!branchName.match(/\s/) ? branchName : this.branch.getBasename(); |
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'm not sure I understand the logic here. Why are you checking if the name contains any whitespace?
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.
In some case like detached git state, the folder name will not be parsed correctly. So here I see any white space as invalid folder branch name, and choose not to handle them. Same logic appears in branchesNode.ts:38
and remoteNode.ts:39
.
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.
Ah ok, but why is it needed? A "branch" with spaces could be handled just the same as any other without '/' characters right? Was there an explicit case you were protecting against?
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 encounter this issue with the branch name like " ✔️ (HEAD detached at xxxxxx/xxxxxx)
", current implementation will split the name to
(HEAD detached at xxxxxx
(branch folder)xxxxxx)
(sub-branch)
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.
Ah -- ok, thanks
@Yukaii I'm trying to finalize GitLens 8 for release and as I'd like to get this in, I'm planning on just getting this in and then remove the |
@eamodio Sure 👍 |
This has been merged into develop and as long as GitLens 8 release candidate looks good this will ship in GitLens 8. FYI, I made a bunch of changes to the behavior here: 112879d
Thanks again for your awesome work! This is a great feature! |
This implements #258
Add
gitlens.gitExplorer.branches.layout
config with three available option:list
,tree
, andmix-tree
list
is the current behavior, would display all branches with full branch name:tree
organize branch name with slashes as folder:mix-tree
sort all branches alphabetically:TODOs
tree
layout