Skip to content

Commit

Permalink
Allows search & compare view to be grouped
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Nov 8, 2024
1 parent 65afa4d commit 1701081
Show file tree
Hide file tree
Showing 16 changed files with 233 additions and 61 deletions.
1 change: 1 addition & 0 deletions images/icons/search-view-filled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion images/icons/search-view.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions images/icons/template/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"contributors-view-filled": 61752,
"remotes-view-filled": 61753,
"repositories-view-filled": 61754,
"stashes-view-filled": 61755,
"tags-view-filled": 61756,
"worktrees-view-filled": 61757
"search-view-filled": 61755,
"stashes-view-filled": 61756,
"tags-view-filled": 61757,
"worktrees-view-filled": 61758
}
176 changes: 154 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8184,8 +8184,7 @@
},
{
"command": "gitlens.views.grouped.branches.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-branches-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.branches.setAsDefault",
Expand All @@ -8198,8 +8197,7 @@
},
{
"command": "gitlens.views.grouped.commits.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-commits-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.commits.setAsDefault",
Expand All @@ -8212,8 +8210,7 @@
},
{
"command": "gitlens.views.grouped.contributors.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-contributors-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.contributors.setAsDefault",
Expand All @@ -8226,8 +8223,7 @@
},
{
"command": "gitlens.views.grouped.remotes.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-remotes-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.remotes.setAsDefault",
Expand All @@ -8240,22 +8236,33 @@
},
{
"command": "gitlens.views.grouped.repositories.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-repositories-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.repositories.setAsDefault",
"title": "Set as Default View"
},
{
"command": "gitlens.views.grouped.searchAndCompare",
"title": "Search & Compare",
"icon": "$(gitlens-search-view)"
},
{
"command": "gitlens.views.grouped.searchAndCompare.moveToNewView",
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.searchAndCompare.setAsDefault",
"title": "Set as Default View"
},
{
"command": "gitlens.views.grouped.stashes",
"title": "Stashes",
"icon": "$(gitlens-stashes-view)"
},
{
"command": "gitlens.views.grouped.stashes.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-stashes-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.stashes.setAsDefault",
Expand All @@ -8268,8 +8275,7 @@
},
{
"command": "gitlens.views.grouped.tags.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-tags-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.tags.setAsDefault",
Expand All @@ -8282,8 +8288,7 @@
},
{
"command": "gitlens.views.grouped.worktrees.moveToNewView",
"title": "Move to Separate View",
"icon": "$(gitlens-worktrees-view)"
"title": "Move to Separate View"
},
{
"command": "gitlens.views.grouped.worktrees.setAsDefault",
Expand Down Expand Up @@ -8672,6 +8677,12 @@
"title": "Copy",
"category": "GitLens"
},
{
"command": "gitlens.views.searchAndCompare.close",
"title": "Close",
"category": "GitLens",
"icon": "$(close)"
},
{
"command": "gitlens.views.searchAndCompare.refresh",
"title": "Refresh",
Expand Down Expand Up @@ -10045,25 +10056,32 @@
"fontCharacter": "\\f13a"
}
},
"gitlens-search-view-filled": {
"description": "search-view-filled icon",
"default": {
"fontPath": "dist/glicons.woff2",
"fontCharacter": "\\f13b"
}
},
"gitlens-stashes-view-filled": {
"description": "stashes-view-filled icon",
"default": {
"fontPath": "dist/glicons.woff2",
"fontCharacter": "\\f13b"
"fontCharacter": "\\f13c"
}
},
"gitlens-tags-view-filled": {
"description": "tags-view-filled icon",
"default": {
"fontPath": "dist/glicons.woff2",
"fontCharacter": "\\f13c"
"fontCharacter": "\\f13d"
}
},
"gitlens-worktrees-view-filled": {
"description": "worktrees-view-filled icon",
"default": {
"fontPath": "dist/glicons.woff2",
"fontCharacter": "\\f13d"
"fontCharacter": "\\f13e"
}
}
},
Expand Down Expand Up @@ -11853,6 +11871,18 @@
"command": "gitlens.views.grouped.repositories.setAsDefault",
"when": "false"
},
{
"command": "gitlens.views.grouped.searchAndCompare",
"when": "false"
},
{
"command": "gitlens.views.grouped.searchAndCompare.moveToNewView",
"when": "false"
},
{
"command": "gitlens.views.grouped.searchAndCompare.setAsDefault",
"when": "false"
},
{
"command": "gitlens.views.grouped.stashes",
"when": "false"
Expand Down Expand Up @@ -12173,6 +12203,10 @@
"command": "gitlens.views.searchAndCompare.copy",
"when": "false"
},
{
"command": "gitlens.views.searchAndCompare.close",
"when": "false"
},
{
"command": "gitlens.views.searchAndCompare.refresh",
"when": "false"
Expand Down Expand Up @@ -13836,6 +13870,17 @@
"when": "view == gitlens.views.grouped && gitlens:views:grouped:views =~ /\\brepositories\\b/ && gitlens:views:grouped:view == repositories",
"group": "navigation@8"
},
{
"command": "gitlens.views.grouped.searchAndCompare",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:views =~ /\\bsearchAndCompare\\b/ && gitlens:views:grouped:view != searchAndCompare",
"group": "navigation@9",
"alt": "gitlens.views.grouped.searchAndCompare.moveToNewView"
},
{
"submenu": "gitlens/views/grouped/searchAndCompare",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:views =~ /\\bsearchAndCompare\\b/ && gitlens:views:grouped:view == searchAndCompare",
"group": "navigation@9"
},
{
"command": "gitlens.views.grouped.refresh",
"when": "view == gitlens.views.grouped",
Expand Down Expand Up @@ -14089,6 +14134,11 @@
{
"command": "gitlens.views.searchAndCompare.refresh",
"when": "view == gitlens.views.searchAndCompare",
"group": "navigation@98"
},
{
"command": "gitlens.views.searchAndCompare.close",
"when": "view == gitlens.views.searchAndCompare && config.gitlens.views.grouped.enabled",
"group": "navigation@99"
},
{
Expand Down Expand Up @@ -17445,12 +17495,12 @@
"gitlens/view/searchAndCompare/new": [
{
"command": "gitlens.views.searchAndCompare.searchCommits",
"when": "view == gitlens.views.searchAndCompare",
"when": "view == gitlens.views.searchAndCompare || (view === gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare)",
"group": "navigation@10"
},
{
"command": "gitlens.views.searchAndCompare.selectForCompare",
"when": "view == gitlens.views.searchAndCompare",
"when": "view == gitlens.views.searchAndCompare || (view === gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare)",
"group": "navigation@11"
}
],
Expand Down Expand Up @@ -17609,6 +17659,38 @@
"group": "2_gitlens_actions@3"
}
],
"gitlens/views/grouped/searchAndCompare": [
{
"command": "gitlens.views.grouped.searchAndCompare.moveToNewView",
"when": "gitlens:views:grouped:view == searchAndCompare",
"group": "2_gitlens@1"
},
{
"command": "gitlens.views.grouped.searchAndCompare.setAsDefault",
"when": "gitlens:views:grouped:view == searchAndCompare && gitlens:views:grouped:default != searchAndCompare",
"group": "2_gitlens@2"
},
{
"submenu": "gitlens/views/grouped/more",
"when": "gitlens:views:grouped:view == searchAndCompare",
"group": "2_gitlens@3"
},
{
"command": "gitlens.views.searchAndCompare.searchCommits",
"when": "view == gitlens.views.searchAndCompare || (view === gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare)",
"group": "2_gitlens_actions@1"
},
{
"command": "gitlens.views.searchAndCompare.selectForCompare",
"when": "view == gitlens.views.searchAndCompare || (view === gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare)",
"group": "2_gitlens_actions@2"
},
{
"command": "gitlens.views.searchAndCompare.clear",
"when": "gitlens:views:grouped:view == searchAndCompare",
"group": "2_gitlens_actions_@1"
}
],
"gitlens/views/grouped/stashes": [
{
"command": "gitlens.views.grouped.stashes.moveToNewView",
Expand Down Expand Up @@ -17966,6 +18048,36 @@
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == repositories",
"group": "9_gitlens@1"
},
{
"command": "gitlens.views.searchAndCompare.setFilesLayoutToAuto",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare && config.gitlens.views.searchAndCompare.files.layout == tree",
"group": "3_gitlens@0"
},
{
"command": "gitlens.views.searchAndCompare.setFilesLayoutToList",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare && config.gitlens.views.searchAndCompare.files.layout == auto",
"group": "3_gitlens@0"
},
{
"command": "gitlens.views.searchAndCompare.setFilesLayoutToTree",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare && config.gitlens.views.searchAndCompare.files.layout == list",
"group": "3_gitlens@0"
},
{
"command": "gitlens.views.searchAndCompare.setShowAvatarsOn",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare && !config.gitlens.views.searchAndCompare.avatars",
"group": "5_gitlens@0"
},
{
"command": "gitlens.views.searchAndCompare.setShowAvatarsOff",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare && config.gitlens.views.searchAndCompare.avatars",
"group": "5_gitlens@0"
},
{
"command": "gitlens.showSettingsPage!search-compare-view",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == searchAndCompare",
"group": "9_gitlens@1"
},
{
"command": "gitlens.views.stashes.setFilesLayoutToAuto",
"when": "view == gitlens.views.grouped && gitlens:views:grouped:view == stashes && config.gitlens.views.stashes.files.layout == tree",
Expand Down Expand Up @@ -18172,6 +18284,11 @@
"label": "Repositories",
"icon": "$(gitlens-repositories-view-filled)"
},
{
"id": "gitlens/views/grouped/searchAndCompare",
"label": "Search & Compare",
"icon": "$(gitlens-search-view-filled)"
},
{
"id": "gitlens/views/grouped/stashes",
"label": "Stashes",
Expand Down Expand Up @@ -18701,16 +18818,31 @@
"contents": "Search for commits by [message](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22message%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [author](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22author%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [SHA](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22commit%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [file](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22file%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), or [changes](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22change%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D)\n\n[Search Commits...](command:gitlens.views.searchAndCompare.searchCommits)",
"when": "!gitlens:hasVirtualFolders"
},
{
"view": "gitlens.views.grouped",
"contents": "Search for commits by [message](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22message%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [author](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22author%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [SHA](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22commit%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [file](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22file%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), or [changes](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22change%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D)\n\n[Search Commits...](command:gitlens.views.searchAndCompare.searchCommits)",
"when": "!gitlens:hasVirtualFolders && gitlens:views:grouped:view == searchAndCompare"
},
{
"view": "gitlens.views.searchAndCompare",
"contents": "Search for commits by [message](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22message%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [author](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22author%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), or [SHA](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22commit%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D)\n\n[Search Commits...](command:gitlens.views.searchAndCompare.searchCommits)",
"when": "gitlens:hasVirtualFolders"
},
{
"view": "gitlens.views.grouped",
"contents": "Search for commits by [message](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22message%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), [author](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22author%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D), or [SHA](command:gitlens.views.searchAndCompare.searchCommits?%7B%22search%22%3A%7B%22query%22%3A%22commit%3A%22%7D%2C%22prefillOnly%22%3Atrue%7D)\n\n[Search Commits...](command:gitlens.views.searchAndCompare.searchCommits)",
"when": "gitlens:hasVirtualFolders && gitlens:views:grouped:view == searchAndCompare"
},
{
"view": "gitlens.views.searchAndCompare",
"contents": "Compare a <branch, tag, or ref> with another <branch, tag, or ref>\n\n[Compare References...](command:gitlens.views.searchAndCompare.selectForCompare)",
"when": "!gitlens:hasVirtualFolders"
},
{
"view": "gitlens.views.grouped",
"contents": "Compare a <branch, tag, or ref> with another <branch, tag, or ref>\n\n[Compare References...](command:gitlens.views.searchAndCompare.selectForCompare)",
"when": "!gitlens:hasVirtualFolders && gitlens:views:grouped:view == searchAndCompare"
},
{
"view": "gitlens.views.drafts",
"contents": "Cloud Patches ᴘʀᴇᴠɪᴇᴡ — easily and securely share code with your teammates or other developers, accessible from anywhere, streamlining your workflow with better collaboration."
Expand Down Expand Up @@ -18956,7 +19088,7 @@
{
"id": "gitlens.views.searchAndCompare",
"name": "Search & Compare",
"when": "!gitlens:disabled",
"when": "!gitlens:disabled && (!config.gitlens.views.grouped.enabled || (config.gitlens.views.grouped.enabled && gitlens:views:grouped:views && !(gitlens:views:grouped:views =~ /\\bsearchAndCompare\\b/)))",
"contextualTitle": "GitLens",
"icon": "$(gitlens-search-view)",
"initialSize": 2,
Expand Down
10 changes: 9 additions & 1 deletion src/constants.views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,15 @@ export type TreeViewTypeFromId<T extends TreeViewIds> = T extends `gitlens.views

export type GroupableTreeViewTypes = Extract<
TreeViewTypes,
'branches' | 'commits' | 'contributors' | 'remotes' | 'repositories' | 'stashes' | 'tags' | 'worktrees'
| 'branches'
| 'commits'
| 'contributors'
| 'remotes'
| 'repositories'
| 'searchAndCompare'
| 'stashes'
| 'tags'
| 'worktrees'
>;
export type GroupableTreeViewIds<T extends GroupableTreeViewTypes = GroupableTreeViewTypes> = TreeViewIds<T>;

Expand Down
Loading

0 comments on commit 1701081

Please sign in to comment.