diff --git a/package.json b/package.json index b2be40a..1bc1a6e 100644 --- a/package.json +++ b/package.json @@ -7229,6 +7229,36 @@ "category": "GitLens" }, { + "command": "gitlens.graph.columnGraphOn", + "title": "Show Graph Column", + "category": "GitLens" + }, + { + "command": "gitlens.graph.columnGraphOff", + "title": "Hide Graph Column", + "category": "GitLens" + }, + { + "command": "gitlens.graph.columnMessageOn", + "title": "Show Commit Message Column", + "category": "GitLens" + }, + { + "command": "gitlens.graph.columnMessageOff", + "title": "Hide Commit Message Column", + "category": "GitLens" + }, + { + "command": "gitlens.graph.columnRefOn", + "title": "Show Branch / Tag Column", + "category": "GitLens" + }, + { + "command": "gitlens.graph.columnRefOff", + "title": "Hide Branch / Tag Column", + "category": "GitLens" + }, + { "command": "gitlens.graph.columnGraphCompact", "title": "Compact Graph Column Layout", "category": "GitLens" @@ -9363,6 +9393,30 @@ "when": "false" }, { + "command": "gitlens.graph.columnGraphOn", + "when": "false" + }, + { + "command": "gitlens.graph.columnGraphOff", + "when": "false" + }, + { + "command": "gitlens.graph.columnMessageOn", + "when": "false" + }, + { + "command": "gitlens.graph.columnMessageOff", + "when": "false" + }, + { + "command": "gitlens.graph.columnRefOn", + "when": "false" + }, + { + "command": "gitlens.graph.columnRefOff", + "when": "false" + }, + { "command": "gitlens.enableDebugLogging", "when": "config.gitlens.outputLevel != debug" }, @@ -12130,38 +12184,68 @@ }, { "command": "gitlens.graph.columnAuthorOff", - "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\bhidden:author\\b).)*$/", + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\b(hidden|only):author\\b).)*$/", "group": "1_columns@1" }, { + "command": "gitlens.graph.columnRefOn", + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /\\bhidden:ref\\b/", + "group": "1_columns@2" + }, + { + "command": "gitlens.graph.columnRefOff", + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\b(hidden|only):ref\\b).)*$/", + "group": "1_columns@2" + }, + { "command": "gitlens.graph.columnChangesOn", "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /\\bhidden:changes\\b/", - "group": "1_columns@2" + "group": "1_columns@3" }, { "command": "gitlens.graph.columnChangesOff", - "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\bhidden:changes\\b).)*$/", - "group": "1_columns@2" + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\b(hidden|only):changes\\b).)*$/", + "group": "1_columns@3" + }, + { + "command": "gitlens.graph.columnMessageOn", + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /\\bhidden:message\\b/", + "group": "1_columns@4" + }, + { + "command": "gitlens.graph.columnMessageOff", + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\b(hidden|only):message\\b).)*$/", + "group": "1_columns@4" }, { "command": "gitlens.graph.columnDateTimeOn", "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /\\bhidden:datetime\\b/", - "group": "1_columns@3" + "group": "1_columns@5" }, { "command": "gitlens.graph.columnDateTimeOff", - "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\bhidden:datetime\\b).)*$/", - "group": "1_columns@3" + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\b(hidden|only):datetime\\b).)*$/", + "group": "1_columns@5" + }, + { + "command": "gitlens.graph.columnGraphOn", + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /\\bhidden:graph\\b/", + "group": "1_columns@6" + }, + { + "command": "gitlens.graph.columnGraphOff", + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\b(hidden|only):graph\\b).)*$/", + "group": "1_columns@6" }, { "command": "gitlens.graph.columnShaOn", "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /\\bhidden:sha\\b/", - "group": "1_columns@4" + "group": "1_columns@7" }, { "command": "gitlens.graph.columnShaOff", - "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\bhidden:sha\\b).)*$/", - "group": "1_columns@4" + "when": "webviewItem =~ /gitlens:graph:columns\\b/ && webviewItemValue =~ /^(?:(?!\\b(hidden|only):sha\\b).)*$/", + "group": "1_columns@7" }, { "command": "gitlens.graph.columnGraphDefault", @@ -13577,7 +13661,7 @@ "vscode:prepublish": "yarn run bundle" }, "dependencies": { - "@gitkraken/gitkraken-components": "8.1.3", + "@gitkraken/gitkraken-components": "8.2.0", "@microsoft/fast-element": "1.11.1", "@microsoft/fast-react-wrapper": "0.3.17", "@octokit/core": "4.2.0", diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index 218a61d..88c201d 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -383,6 +383,12 @@ export class GraphWebviewProvider implements WebviewProvider { registerCommand('gitlens.graph.columnShaOff', () => this.toggleColumn('sha', false)), registerCommand('gitlens.graph.columnChangesOn', () => this.toggleColumn('changes', true)), registerCommand('gitlens.graph.columnChangesOff', () => this.toggleColumn('changes', false)), + registerCommand('gitlens.graph.columnGraphOn', () => this.toggleColumn('graph', true)), + registerCommand('gitlens.graph.columnGraphOff', () => this.toggleColumn('graph', false)), + registerCommand('gitlens.graph.columnMessageOn', () => this.toggleColumn('message', true)), + registerCommand('gitlens.graph.columnMessageOff', () => this.toggleColumn('message', false)), + registerCommand('gitlens.graph.columnRefOn', () => this.toggleColumn('ref', true)), + registerCommand('gitlens.graph.columnRefOff', () => this.toggleColumn('ref', false)), registerCommand('gitlens.graph.columnGraphCompact', () => this.setColumnMode('graph', 'compact')), registerCommand('gitlens.graph.columnGraphDefault', () => this.setColumnMode('graph', undefined)), @@ -1553,15 +1559,30 @@ export class GraphWebviewProvider implements WebviewProvider { private getColumnHeaderContext(columnSettings: GraphColumnsSettings): string { const contextItems: string[] = []; + // Old column settings that didn't get cleaned up can mess with calculation of only visible column. + // All currently used ones are listed here. + const validColumns = ['author', 'changes', 'datetime', 'graph', 'message', 'ref', 'sha']; + + let onlyVisibleColumn: string | undefined; for (const [name, settings] of Object.entries(columnSettings)) { + if (!validColumns.includes(name)) continue; if (settings.isHidden) { contextItems.push(`hidden:${name}`); + } else if (onlyVisibleColumn == null) { + onlyVisibleColumn = name; + } else { + onlyVisibleColumn = undefined; } if (settings.mode) { contextItems.push(`${settings.mode}:${name}`); } } + + if (onlyVisibleColumn != null) { + contextItems.push(`only:${onlyVisibleColumn}`); + } + return serializeWebviewItemContext({ webviewItem: 'gitlens:graph:columns', webviewItemValue: contextItems.join(','), diff --git a/yarn.lock b/yarn.lock index 04eebc9..8f4f79a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -202,10 +202,10 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== -"@gitkraken/gitkraken-components@8.1.3": - version "8.1.3" - resolved "https://registry.yarnpkg.com/@gitkraken/gitkraken-components/-/gitkraken-components-8.1.3.tgz#cd8da2450695484616ac53d96343259a3180ad9f" - integrity sha512-8dTEBrLgOgAfW8zBi604TfBJ1j2AOKqaZerMlJzqqLUSY11GKrO29wJ6dC/saSN973XTJVOQMgjE80rAIabHVw== +"@gitkraken/gitkraken-components@8.2.0": + version "8.2.0" + resolved "https://registry.yarnpkg.com/@gitkraken/gitkraken-components/-/gitkraken-components-8.2.0.tgz#27da91ac6f814a04a3d1cc8aa063cc854a6626f4" + integrity sha512-fQ2Kvnduz8PKvJqfCSvQIRkO4b9trwQrNrFiOGfknQqkaPgqPyLGIpP9gbeB7lA+EFngMszIH4G1PejIMq4jZg== dependencies: "@axosoft/react-virtualized" "9.22.3-gitkraken.3" classnames "2.3.2"