Skip to content

Commit 9bfae95

Browse files
committed
Splits file/folder history menus
Adds Open Visual Folder History to explorer folders Adds Open [Visual] Folder History to folders in views
1 parent 6387120 commit 9bfae95

File tree

14 files changed

+161
-82
lines changed

14 files changed

+161
-82
lines changed

contributions.json

Lines changed: 69 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3063,7 +3063,7 @@
30633063
"order": 1
30643064
}
30653065
],
3066-
"gitlens/explorer/history": [
3066+
"gitlens/explorer/file/history": [
30673067
{
30683068
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled",
30693069
"group": "1_gitlens",
@@ -3195,9 +3195,8 @@
31953195
"gitlens.openFolderHistory": {
31963196
"label": "Open Folder History",
31973197
"menus": {
3198-
"gitlens/explorer/history": [
3198+
"gitlens/explorer/folder/history": [
31993199
{
3200-
"when": "explorerResourceIsFolder && gitlens:enabled",
32013200
"group": "1_gitlens",
32023201
"order": 1
32033202
}
@@ -3518,7 +3517,7 @@
35183517
"order": 1
35193518
}
35203519
],
3521-
"gitlens/explorer/history": [
3520+
"gitlens/explorer/file/history": [
35223521
{
35233522
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled",
35243523
"group": "1_gitlens_quick",
@@ -3686,6 +3685,50 @@
36863685
"label": "Show File History View",
36873686
"commandPalette": "gitlens:enabled"
36883687
},
3688+
"gitlens.showFileInTimeline": {
3689+
"label": "Open Visual File History",
3690+
"icon": "$(graph-scatter)",
3691+
"commandPalette": "gitlens:enabled && resource in gitlens:tabs:tracked",
3692+
"menus": {
3693+
"gitlens/commit/file/history": [
3694+
{
3695+
"group": "1_gitlens",
3696+
"order": 2
3697+
}
3698+
],
3699+
"gitlens/editor/history": [
3700+
{
3701+
"group": "1_gitlens",
3702+
"order": 2
3703+
}
3704+
],
3705+
"gitlens/explorer/file/history": [
3706+
{
3707+
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled",
3708+
"group": "1_gitlens",
3709+
"order": 2
3710+
}
3711+
],
3712+
"gitlens/scm/resourceState/history": [
3713+
{
3714+
"group": "1_gitlens",
3715+
"order": 2
3716+
}
3717+
]
3718+
}
3719+
},
3720+
"gitlens.showFolderInTimeline": {
3721+
"label": "Open Visual Folder History",
3722+
"icon": "$(graph-scatter)",
3723+
"menus": {
3724+
"gitlens/explorer/folder/history": [
3725+
{
3726+
"group": "1_gitlens",
3727+
"order": 2
3728+
}
3729+
]
3730+
}
3731+
},
36893732
"gitlens.showGraph": {
36903733
"label": "Show Commit Graph",
36913734
"icon": "$(gitlens-graph)",
@@ -3811,38 +3854,6 @@
38113854
]
38123855
}
38133856
},
3814-
"gitlens.showInTimeline": {
3815-
"label": "Open Visual File History",
3816-
"icon": "$(graph-scatter)",
3817-
"commandPalette": "gitlens:enabled && resource in gitlens:tabs:tracked",
3818-
"menus": {
3819-
"gitlens/commit/file/history": [
3820-
{
3821-
"group": "1_gitlens",
3822-
"order": 2
3823-
}
3824-
],
3825-
"gitlens/editor/history": [
3826-
{
3827-
"group": "1_gitlens",
3828-
"order": 2
3829-
}
3830-
],
3831-
"gitlens/explorer/history": [
3832-
{
3833-
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled",
3834-
"group": "1_gitlens",
3835-
"order": 2
3836-
}
3837-
],
3838-
"gitlens/scm/resourceState/history": [
3839-
{
3840-
"group": "1_gitlens",
3841-
"order": 2
3842-
}
3843-
]
3844-
}
3845-
},
38463857
"gitlens.showLastQuickPick": {
38473858
"label": "Show Last Opened Quick Pick",
38483859
"commandPalette": "gitlens:enabled"
@@ -5312,7 +5323,7 @@
53125323
"menus": {
53135324
"view/item/context": [
53145325
{
5315-
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|results|search|status|tag)\\b/ && !listMultiSelection",
5326+
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|pseudo:folder|results|search|status|tag)\\b/ && !listMultiSelection",
53165327
"group": "9_gitlens",
53175328
"order": 1
53185329
}
@@ -6567,7 +6578,7 @@
65676578
"menus": {
65686579
"view/item/context": [
65696580
{
6570-
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|results|search|status|tag)\\b/ && !listMultiSelection",
6581+
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|pseudo:folder|results|search|status|tag)\\b/ && !listMultiSelection",
65716582
"group": "9_gitlens",
65726583
"order": 2
65736584
}
@@ -11937,7 +11948,7 @@
1193711948
]
1193811949
}
1193911950
},
11940-
"gitlens/explorer/history": {
11951+
"gitlens/explorer/file/history": {
1194111952
"label": "File History",
1194211953
"menus": {
1194311954
"explorer/context": [
@@ -11949,6 +11960,25 @@
1194911960
]
1195011961
}
1195111962
},
11963+
"gitlens/explorer/folder/history": {
11964+
"label": "Folder History",
11965+
"menus": {
11966+
"explorer/context": [
11967+
{
11968+
"when": "gitlens:enabled && config.gitlens.menus.explorer.history",
11969+
"group": "4_timeline",
11970+
"order": 0
11971+
}
11972+
],
11973+
"view/item/context": [
11974+
{
11975+
"when": "viewItem =~ /gitlens:folder\\b/",
11976+
"group": "4_timeline",
11977+
"order": 1
11978+
}
11979+
]
11980+
}
11981+
},
1195211982
"gitlens/explorer/openOn": {
1195311983
"label": "Open on Remote (Web)",
1195411984
"menus": {

package.json

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7196,6 +7196,17 @@
71967196
"title": "Show File History View",
71977197
"category": "GitLens"
71987198
},
7199+
{
7200+
"command": "gitlens.showFileInTimeline",
7201+
"title": "Open Visual File History",
7202+
"category": "GitLens",
7203+
"icon": "$(graph-scatter)"
7204+
},
7205+
{
7206+
"command": "gitlens.showFolderInTimeline",
7207+
"title": "Open Visual Folder History",
7208+
"icon": "$(graph-scatter)"
7209+
},
71997210
{
72007211
"command": "gitlens.showGraph",
72017212
"title": "Show Commit Graph",
@@ -7234,12 +7245,6 @@
72347245
"title": "Inspect Details",
72357246
"icon": "$(eye)"
72367247
},
7237-
{
7238-
"command": "gitlens.showInTimeline",
7239-
"title": "Open Visual File History",
7240-
"category": "GitLens",
7241-
"icon": "$(graph-scatter)"
7242-
},
72437248
{
72447249
"command": "gitlens.showLastQuickPick",
72457250
"title": "Show Last Opened Quick Pick",
@@ -10984,6 +10989,14 @@
1098410989
"command": "gitlens.showFileHistoryView",
1098510990
"when": "gitlens:enabled"
1098610991
},
10992+
{
10993+
"command": "gitlens.showFileInTimeline",
10994+
"when": "gitlens:enabled && resource in gitlens:tabs:tracked"
10995+
},
10996+
{
10997+
"command": "gitlens.showFolderInTimeline",
10998+
"when": "false"
10999+
},
1098711000
{
1098811001
"command": "gitlens.showGraph",
1098911002
"when": "gitlens:enabled"
@@ -11008,10 +11021,6 @@
1100811021
"command": "gitlens.showInDetailsView",
1100911022
"when": "false"
1101011023
},
11011-
{
11012-
"command": "gitlens.showInTimeline",
11013-
"when": "gitlens:enabled && resource in gitlens:tabs:tracked"
11014-
},
1101511024
{
1101611025
"command": "gitlens.showLastQuickPick",
1101711026
"when": "gitlens:enabled"
@@ -13143,7 +13152,12 @@
1314313152
"group": "4_t_gitlens@1"
1314413153
},
1314513154
{
13146-
"submenu": "gitlens/explorer/history",
13155+
"submenu": "gitlens/explorer/file/history",
13156+
"when": "gitlens:enabled && config.gitlens.menus.explorer.history",
13157+
"group": "4_timeline@0"
13158+
},
13159+
{
13160+
"submenu": "gitlens/explorer/folder/history",
1314713161
"when": "gitlens:enabled && config.gitlens.menus.explorer.history",
1314813162
"group": "4_timeline@0"
1314913163
},
@@ -13384,7 +13398,7 @@
1338413398
"group": "1_gitlens@1"
1338513399
},
1338613400
{
13387-
"command": "gitlens.showInTimeline",
13401+
"command": "gitlens.showFileInTimeline",
1338813402
"group": "1_gitlens@2"
1338913403
},
1339013404
{
@@ -13598,7 +13612,7 @@
1359813612
"group": "1_gitlens@1"
1359913613
},
1360013614
{
13601-
"command": "gitlens.showInTimeline",
13615+
"command": "gitlens.showFileInTimeline",
1360213616
"group": "1_gitlens@2"
1360313617
},
1360413618
{
@@ -13707,19 +13721,14 @@
1370713721
"group": "1_gitlens@3"
1370813722
}
1370913723
],
13710-
"gitlens/explorer/history": [
13724+
"gitlens/explorer/file/history": [
1371113725
{
1371213726
"command": "gitlens.openFileHistory",
1371313727
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled",
1371413728
"group": "1_gitlens@1"
1371513729
},
1371613730
{
13717-
"command": "gitlens.openFolderHistory",
13718-
"when": "explorerResourceIsFolder && gitlens:enabled",
13719-
"group": "1_gitlens@1"
13720-
},
13721-
{
13722-
"command": "gitlens.showInTimeline",
13731+
"command": "gitlens.showFileInTimeline",
1372313732
"when": "!explorerResourceIsRoot && !explorerResourceIsFolder && gitlens:enabled",
1372413733
"group": "1_gitlens@2"
1372513734
},
@@ -13729,6 +13738,16 @@
1372913738
"group": "1_gitlens_quick@1"
1373013739
}
1373113740
],
13741+
"gitlens/explorer/folder/history": [
13742+
{
13743+
"command": "gitlens.openFolderHistory",
13744+
"group": "1_gitlens@1"
13745+
},
13746+
{
13747+
"command": "gitlens.showFolderInTimeline",
13748+
"group": "1_gitlens@2"
13749+
}
13750+
],
1373213751
"gitlens/explorer/openOn": [
1373313752
{
1373413753
"command": "gitlens.openFileOnRemote",
@@ -13892,7 +13911,7 @@
1389213911
"group": "1_gitlens@1"
1389313912
},
1389413913
{
13895-
"command": "gitlens.showInTimeline",
13914+
"command": "gitlens.showFileInTimeline",
1389613915
"group": "1_gitlens@2"
1389713916
},
1389813917
{
@@ -15478,12 +15497,12 @@
1547815497
},
1547915498
{
1548015499
"command": "gitlens.views.collapseNode",
15481-
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|results|search|status|tag)\\b/ && !listMultiSelection",
15500+
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|pseudo:folder|results|search|status|tag)\\b/ && !listMultiSelection",
1548215501
"group": "9_gitlens@1"
1548315502
},
1548415503
{
1548515504
"command": "gitlens.views.expandNode",
15486-
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|results|search|status|tag)\\b/ && !listMultiSelection",
15505+
"when": "viewItem =~ /gitlens:(branch|compare|folder|grouping|pseudo:folder|results|search|status|tag)\\b/ && !listMultiSelection",
1548715506
"group": "9_gitlens@2"
1548815507
},
1548915508
{
@@ -16112,6 +16131,11 @@
1611216131
"when": "viewItem =~ /gitlens:folder\\b(?=.*?\\b\\+working\\b)/ && !listMultiSelection && !gitlens:hasVirtualFolders && !gitlens:readonly && !gitlens:untrusted",
1611316132
"group": "1_gitlens_actions@2"
1611416133
},
16134+
{
16135+
"submenu": "gitlens/explorer/folder/history",
16136+
"when": "viewItem =~ /gitlens:folder\\b/",
16137+
"group": "4_timeline@1"
16138+
},
1611516139
{
1611616140
"command": "gitlens.views.openFile",
1611716141
"when": "viewItem =~ /gitlens:(history:(file|line)|status:file)\\b/",
@@ -18811,9 +18835,13 @@
1881118835
"label": "Open Changes"
1881218836
},
1881318837
{
18814-
"id": "gitlens/explorer/history",
18838+
"id": "gitlens/explorer/file/history",
1881518839
"label": "File History"
1881618840
},
18841+
{
18842+
"id": "gitlens/explorer/folder/history",
18843+
"label": "Folder History"
18844+
},
1881718845
{
1881818846
"id": "gitlens/explorer/openOn",
1881918847
"label": "Open on Remote (Web)"

src/constants.commands.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ export const enum GlCommand {
183183
ShowInCommitGraph = 'gitlens.showInCommitGraph',
184184
ShowInCommitGraphView = 'gitlens.showInCommitGraphView',
185185
ShowInDetailsView = 'gitlens.showInDetailsView',
186-
ShowInTimeline = 'gitlens.showInTimeline',
186+
ShowFileInTimeline = 'gitlens.showFileInTimeline',
187+
ShowFolderInTimeline = 'gitlens.showFolderInTimeline',
187188
ShowLastQuickPick = 'gitlens.showLastQuickPick',
188189
ShowLaunchpad = 'gitlens.showLaunchpad',
189190
ShowLaunchpadView = 'gitlens.showLaunchpadView',

src/env/node/git/localGitProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ import { compare, fromString } from '../../../system/version';
164164
import { TimedCancellationSource } from '../../../system/vscode/cancellation';
165165
import { configuration } from '../../../system/vscode/configuration';
166166
import { getBestPath, relative, splitPath } from '../../../system/vscode/path';
167-
import { isFolder } from '../../../system/vscode/utils';
167+
import { isFolderUri } from '../../../system/vscode/utils';
168168
import { serializeWebviewItemContext } from '../../../system/webview';
169169
import type { CachedBlame, CachedDiff, CachedLog, TrackedGitDocument } from '../../../trackers/trackedDocument';
170170
import { GitDocumentState } from '../../../trackers/trackedDocument';
@@ -1283,7 +1283,7 @@ export class LocalGitProvider implements GitProvider, Disposable {
12831283
let repoPath: string | undefined;
12841284
try {
12851285
if (isDirectory == null) {
1286-
isDirectory = await isFolder(uri);
1286+
isDirectory = await isFolderUri(uri);
12871287
}
12881288

12891289
// If the uri isn't a directory, go up one level

src/env/node/git/vslsGitProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { Repository } from '../../../git/models/repository';
88
import { Logger } from '../../../system/logger';
99
import { getLogScope } from '../../../system/logger.scope';
1010
import { addVslsPrefixIfNeeded } from '../../../system/vscode/path';
11-
import { isFolder } from '../../../system/vscode/utils';
11+
import { isFolderUri } from '../../../system/vscode/utils';
1212
import { Git } from './git';
1313
import { LocalGitProvider } from './localGitProvider';
1414

@@ -107,7 +107,7 @@ export class VslsGitProvider extends LocalGitProvider {
107107
let repoPath: string | undefined;
108108
try {
109109
if (isDirectory == null) {
110-
isDirectory = await isFolder(uri);
110+
isDirectory = await isFolderUri(uri);
111111
}
112112

113113
// If the uri isn't a directory, go up one level

0 commit comments

Comments
 (0)