diff --git a/CHANGELOG.md b/CHANGELOG.md index 707b82aeb5b6c..15541ea9db167 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p - Changes the default _Commit Graph_ lane colors for dark and high-contrast themes to a new vibrant, perceptually-uniform palette — every lane shares the same perceived brightness so no lane visually dominates; light themes keep the previous colors, and any `gitlens.graphLane1Color`–`gitlens.graphLane10Color` customizations in `workbench.colorCustomizations` are still honored - Changes the _Commit Graph_ sidebar to be unpinned by default — the sidebar now floats over the graph and auto-collapses when it loses focus; pin it (or set `gitlens.graph.sidebar.pinned` to `true`) to restore the previous shared-space layout ([#5447](https://github.com/gitkraken/vscode-gitlens/issues/5447)) +- Changes the _Commit Graph_ to automatically use a compact graph column and hide the SHA and Changes columns when the graph is narrow — based on the graph's actual width rather than where the details panel is pinned, so your column layout for a wide graph is preserved and restored once it's wide again; while narrow, the corresponding column menu items are disabled with a note that they return when the graph is wider ([#5500](https://github.com/gitkraken/vscode-gitlens/issues/5500), [#5391](https://github.com/gitkraken/vscode-gitlens/issues/5391)) ### Removed diff --git a/contributions.json b/contributions.json index d2b91ed59fda4..2182f0121bd80 100644 --- a/contributions.json +++ b/contributions.json @@ -3016,7 +3016,7 @@ }, "gitlens.graph.columnChangesOff": { "label": "Hide Changes Column", - "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/", + "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/ && !(webviewItemValue =~ /\\bcolumns:narrow\\b/)", "menus": { "webview/context": [ { @@ -3029,6 +3029,7 @@ }, "gitlens.graph.columnChangesOn": { "label": "Show Changes Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)", "menus": { "webview/context": [ { @@ -3066,6 +3067,7 @@ }, "gitlens.graph.columnGraphCompact": { "label": "Use Compact Graph Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)", "menus": { "webview/context": [ { @@ -3078,6 +3080,7 @@ }, "gitlens.graph.columnGraphDefault": { "label": "Use Expanded Graph Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)", "menus": { "webview/context": [ { @@ -3165,7 +3168,7 @@ }, "gitlens.graph.columnShaOff": { "label": "Hide SHA Column", - "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/", + "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/ && !(webviewItemValue =~ /\\bcolumns:narrow\\b/)", "menus": { "webview/context": [ { @@ -3178,6 +3181,7 @@ }, "gitlens.graph.columnShaOn": { "label": "Show SHA Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)", "menus": { "webview/context": [ { @@ -3188,6 +3192,19 @@ ] } }, + "gitlens.graph.columnsNarrowInfo": { + "label": "Some Options Return When the Graph Is Wider", + "enablement": "false", + "menus": { + "webview/context": [ + { + "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumns:narrow\\b/", + "group": "1_columns", + "order": 0 + } + ] + } + }, "gitlens.graph.commitViaSCM": { "label": "Commit via Source Control..." }, diff --git a/package.json b/package.json index bcc5b81cd7df0..91edefa484559 100644 --- a/package.json +++ b/package.json @@ -7809,11 +7809,12 @@ { "command": "gitlens.graph.columnChangesOff", "title": "Hide Changes Column", - "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/" + "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/ && !(webviewItemValue =~ /\\bcolumns:narrow\\b/)" }, { "command": "gitlens.graph.columnChangesOn", - "title": "Show Changes Column" + "title": "Show Changes Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)" }, { "command": "gitlens.graph.columnDateTimeOff", @@ -7826,11 +7827,13 @@ }, { "command": "gitlens.graph.columnGraphCompact", - "title": "Use Compact Graph Column" + "title": "Use Compact Graph Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)" }, { "command": "gitlens.graph.columnGraphDefault", - "title": "Use Expanded Graph Column" + "title": "Use Expanded Graph Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)" }, { "command": "gitlens.graph.columnGraphOff", @@ -7862,11 +7865,17 @@ { "command": "gitlens.graph.columnShaOff", "title": "Hide SHA Column", - "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/" + "enablement": "webviewItemValue =~ /\\bcolumns:canHide\\b/ && !(webviewItemValue =~ /\\bcolumns:narrow\\b/)" }, { "command": "gitlens.graph.columnShaOn", - "title": "Show SHA Column" + "title": "Show SHA Column", + "enablement": "!(webviewItemValue =~ /\\bcolumns:narrow\\b/)" + }, + { + "command": "gitlens.graph.columnsNarrowInfo", + "title": "Some Options Return When the Graph Is Wider", + "enablement": "false" }, { "command": "gitlens.graph.commitViaSCM", @@ -13611,6 +13620,10 @@ "command": "gitlens.graph.columnShaOn", "when": "false" }, + { + "command": "gitlens.graph.columnsNarrowInfo", + "when": "false" + }, { "command": "gitlens.graph.commitViaSCM", "when": "false" @@ -27183,11 +27196,6 @@ "when": "webviewItem =~ /gitlens:commit\\b/ && !listMultiSelection && !gitlens:readonly && !gitlens:untrusted && gitlens:ai:allowed", "group": "1_gitlens_ai@10" }, - { - "submenu": "gitlens/graph/commit/changes", - "when": "webviewItem =~ /gitlens:(commit|stash|wip)\\b/ && !listMultiSelection", - "group": "2_gitlens_quickopen@1" - }, { "command": "gitlens.graph.openCommitOnRemote", "when": "webviewItem =~ /gitlens:commit\\b/ && !listMultiSelection && gitlens:repos:withRemotes", @@ -27313,6 +27321,11 @@ "when": "webviewItem =~ /gitlens:(branch|commit|stash|tag|file\\b(?=.*?\\b\\+(committed|staged|unstaged)\\b))\\b/", "group": "7_gitlens_a_share@1" }, + { + "submenu": "gitlens/graph/commit/changes", + "when": "webviewItem =~ /gitlens:(commit|stash|wip)\\b/ && !listMultiSelection", + "group": "2_gitlens_quickopen@1" + }, { "command": "gitlens.discardChanges:commitDetails", "when": "webviewItem =~ /gitlens:file\\b(?=.*?\\b\\+(staged|unstaged|conflict)\\b)/ && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && webview == gitlens.views.commitDetails", @@ -27503,6 +27516,11 @@ "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/", "group": "0_markers@0" }, + { + "command": "gitlens.graph.columnsNarrowInfo", + "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumns:narrow\\b/", + "group": "1_columns@0" + }, { "command": "gitlens.graph.columnAuthorOff", "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:author:visible\\b/", @@ -27563,51 +27581,6 @@ "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:sha:hidden\\b/", "group": "1_columns@7" }, - { - "command": "gitlens.graph.columnGraphCompact", - "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:graph:visible(?![^,]*\\+compact\\b)/", - "group": "2_columns@2" - }, - { - "command": "gitlens.graph.columnGraphDefault", - "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:graph:visible[^,]*\\+compact\\b/", - "group": "2_columns@2" - }, - { - "command": "gitlens.fetchRemote:graph", - "when": "webviewItem =~ /gitlens:remote\\b/ && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders", - "group": "1_gitlens_actions@1" - }, - { - "command": "gitlens.discardChanges.multi:commitDetails", - "when": "listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && webview == gitlens.views.commitDetails && webviewItemsUnion =~ /gitlens:file\\b(?=.*?\\b\\+(staged|unstaged|conflict)\\b)(?!.*?\\b\\+(committed|stashed)\\b)/", - "group": "1_gitlens_actions@3" - }, - { - "command": "gitlens.discardChanges.multi:graphDetails", - "when": "webviewItemsUnion =~ /gitlens:file\\b(?=.*?\\b\\+(staged|unstaged|conflict)\\b)(?!.*?\\b\\+(committed|stashed)\\b)/ && listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && (webview == gitlens.graph || webview == gitlens.views.graph)", - "group": "1_gitlens_actions@3" - }, - { - "command": "gitlens.copyRelativePathToClipboard:commitDetails", - "when": "webviewItem =~ /gitlens:(file|folder)\\b/ && webview == gitlens.views.commitDetails", - "group": "7_gitlens_cutcopypaste@2" - }, - { - "command": "gitlens.copyRelativePathToClipboard:graphDetails", - "when": "webviewItem =~ /gitlens:(file|folder)\\b/ && (webview == gitlens.graph || webview == gitlens.views.graph)", - "group": "7_gitlens_cutcopypaste@2" - }, - { - "command": "gitlens.graph.columnAuthorOn", - "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:author:hidden\\b/", - "group": "1_columns@1" - }, - { - "command": "gitlens.graph.columnChangesOff", - "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:changes:visible\\b/", - "group": "1_columns@3" - }, { "command": "gitlens.graph.setStyleAuto", "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && config.gitlens.graph.experimental.useNewEngine", @@ -27623,6 +27596,16 @@ "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && config.gitlens.graph.experimental.useNewEngine", "group": "2_columns@1" }, + { + "command": "gitlens.graph.columnGraphCompact", + "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:graph:visible(?![^,]*\\+compact\\b)/", + "group": "2_columns@2" + }, + { + "command": "gitlens.graph.columnGraphDefault", + "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:graph:visible[^,]*\\+compact\\b/", + "group": "2_columns@2" + }, { "command": "gitlens.graph.setLaneDensityToCompact", "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && config.gitlens.graph.experimental.useNewEngine && webviewItemValue =~ /lanes:density:expanded\\b/", @@ -27673,11 +27656,46 @@ "when": "webviewItem =~ /gitlens:rebase:conflict\\+file\\b(?=.*?\\+canStageIncoming\\b)/ && webview == gitlens.rebase", "group": "1_conflict@2" }, + { + "command": "gitlens.fetchRemote:graph", + "when": "webviewItem =~ /gitlens:remote\\b/ && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders", + "group": "1_gitlens_actions@1" + }, { "command": "gitlens.pruneRemote:graph", "when": "webviewItem =~ /gitlens:remote\\b/ && !gitlens:readonly && !gitlens:untrusted", "group": "1_gitlens_actions@2" }, + { + "command": "gitlens.discardChanges.multi:commitDetails", + "when": "listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && webview == gitlens.views.commitDetails && webviewItemsUnion =~ /gitlens:file\\b(?=.*?\\b\\+(staged|unstaged|conflict)\\b)(?!.*?\\b\\+(committed|stashed)\\b)/", + "group": "1_gitlens_actions@3" + }, + { + "command": "gitlens.discardChanges.multi:graphDetails", + "when": "webviewItemsUnion =~ /gitlens:file\\b(?=.*?\\b\\+(staged|unstaged|conflict)\\b)(?!.*?\\b\\+(committed|stashed)\\b)/ && listMultiSelection && !gitlens:readonly && !gitlens:untrusted && !gitlens:hasVirtualFolders && (webview == gitlens.graph || webview == gitlens.views.graph)", + "group": "1_gitlens_actions@3" + }, + { + "command": "gitlens.copyRelativePathToClipboard:commitDetails", + "when": "webviewItem =~ /gitlens:(file|folder)\\b/ && webview == gitlens.views.commitDetails", + "group": "7_gitlens_cutcopypaste@2" + }, + { + "command": "gitlens.copyRelativePathToClipboard:graphDetails", + "when": "webviewItem =~ /gitlens:(file|folder)\\b/ && (webview == gitlens.graph || webview == gitlens.views.graph)", + "group": "7_gitlens_cutcopypaste@2" + }, + { + "command": "gitlens.graph.columnAuthorOn", + "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:author:hidden\\b/", + "group": "1_columns@1" + }, + { + "command": "gitlens.graph.columnChangesOff", + "when": "webviewItem =~ /gitlens:graph:(columns|settings)\\b/ && webviewItemValue =~ /\\bcolumn:changes:visible\\b/", + "group": "1_columns@3" + }, { "command": "gitlens.openRepoOnRemote:graph", "when": "webviewItem =~ /gitlens:remote\\b/", diff --git a/src/constants.commands.generated.ts b/src/constants.commands.generated.ts index 12b0807b42403..a9585812adfd5 100644 --- a/src/constants.commands.generated.ts +++ b/src/constants.commands.generated.ts @@ -164,6 +164,7 @@ export type ContributedCommands = | 'gitlens.graph.columnRefOn' | 'gitlens.graph.columnShaOff' | 'gitlens.graph.columnShaOn' + | 'gitlens.graph.columnsNarrowInfo' | 'gitlens.graph.compareAncestryWithWorking' | 'gitlens.graph.compareBranchWithHead' | 'gitlens.graph.compareSelectedCommits.multi' diff --git a/src/webviews/apps/plus/graph/graph-app.ts b/src/webviews/apps/plus/graph/graph-app.ts index 939cb8e736dd1..ac83e19301673 100644 --- a/src/webviews/apps/plus/graph/graph-app.ts +++ b/src/webviews/apps/plus/graph/graph-app.ts @@ -2010,6 +2010,7 @@ export class GraphApp extends SignalWatcher(LitElement) { : nothing}