diff --git a/package.json b/package.json index ae02f20..9564531 100644 --- a/package.json +++ b/package.json @@ -2097,7 +2097,7 @@ "gitlens.graph.avatars": { "type": "boolean", "default": true, - "markdownDescription": "Specifies whether to show avatar images instead of author initials in the _Commit Graph_", + "markdownDescription": "Specifies whether to show avatar images instead of author initials and remote icons in the _Commit Graph_", "scope": "window", "order": 10 }, @@ -2108,12 +2108,32 @@ "scope": "window", "order": 11 }, + "gitlens.graph.showDetailsView": { + "type": [ + "boolean", + "string" + ], + "default": "selection", + "enum": [ + false, + "open", + "selection" + ], + "enumDescriptions": [ + "Never shows the _Commit Details_ view automatically", + "Shows the _Commit Details_ view automatically when the _Commit Graph_ is first opened", + "Shows the _Commit Details_ view automatically when selection changes in the _Commit Graph_" + ], + "markdownDescription": "Specifies when to show the _Commit Details_ view for the selected row in the _Commit Graph_", + "scope": "window", + "order": 12 + }, "gitlens.graph.showGhostRefsOnRowHover": { "type": "boolean", "default": true, - "markdownDescription": "Specifies whether to show a ghost ref of the hovered/selected row in the _Commit Graph_", + "markdownDescription": "Specifies whether to show a ghost ref for the hovered/selected row in the _Commit Graph_", "scope": "window", - "order": 12 + "order": 13 }, "gitlens.graph.defaultItemLimit": { "type": "number", diff --git a/src/commands/gitCommands.actions.ts b/src/commands/gitCommands.actions.ts index 0fe7b6b..cdf14b8 100644 --- a/src/commands/gitCommands.actions.ts +++ b/src/commands/gitCommands.actions.ts @@ -768,7 +768,7 @@ export namespace GitActions { export function showDetailsView( commit: GitRevisionReference | GitCommit, - options?: { pin?: boolean; preserveFocus?: boolean }, + options?: { pin?: boolean; preserveFocus?: boolean; preserveVisibility?: boolean }, ): Promise { return Container.instance.commitDetailsView.show({ ...options, commit: commit }); } diff --git a/src/config.ts b/src/config.ts index c779a51..b331706 100644 --- a/src/config.ts +++ b/src/config.ts @@ -380,6 +380,7 @@ export interface GraphConfig { dateStyle: DateStyle | null; defaultItemLimit: number; highlightRowsOnRefHover: boolean; + showDetailsView: 'open' | 'selection' | false; showGhostRefsOnRowHover: boolean; pageItemLimit: number; searchItemLimit: number; diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index 2937ead..2648d97 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -1664,6 +1664,8 @@ export class LocalGitProvider implements GitProvider, Disposable { ); } + const useAvatars = configuration.get('graph.avatars', undefined, true); + const avatars = new Map(); const ids = new Set(); const reachableFromHEAD = new Set(); @@ -1829,7 +1831,7 @@ export class LocalGitProvider implements GitProvider, Disposable { owner: remote.name, url: remote.url, avatarUrl: ( - remote.provider?.avatarUri ?? + (useAvatars ? remote.provider?.avatarUri : undefined) ?? getRemoteIconUri(this.container, remote, asWebviewUri) )?.toString(true), context: serializeWebviewItemContext({ diff --git a/src/plus/github/githubGitProvider.ts b/src/plus/github/githubGitProvider.ts index 0f3bcb1a..9566227 100644 --- a/src/plus/github/githubGitProvider.ts +++ b/src/plus/github/githubGitProvider.ts @@ -1078,6 +1078,7 @@ export class GitHubGitProvider implements GitProvider, Disposable { const defaultLimit = options?.limit ?? configuration.get('graph.defaultItemLimit') ?? 5000; // const defaultPageLimit = configuration.get('graph.pageItemLimit') ?? 1000; const ordering = configuration.get('graph.commitOrdering', undefined, 'date'); + const useAvatars = configuration.get('graph.avatars', undefined, true); const [logResult, branchResult, remotesResult, tagsResult, currentUserResult] = await Promise.allSettled([ this.getLog(repoPath, { all: true, ordering: ordering, limit: defaultLimit }), @@ -1100,7 +1101,7 @@ export class GitHubGitProvider implements GitProvider, Disposable { getSettledValue(currentUserResult), avatars, ids, - options, + { ...options, useAvatars: useAvatars }, ); } @@ -1119,6 +1120,7 @@ export class GitHubGitProvider implements GitProvider, Disposable { limit?: number; mode?: 'single' | 'local' | 'all'; ref?: string; + useAvatars?: boolean; }, ): Promise { if (log == null) { @@ -1184,7 +1186,8 @@ export class GitHubGitProvider implements GitProvider, Disposable { owner: remote.name, url: remote.url, avatarUrl: ( - remote.provider?.avatarUri ?? getRemoteIconUri(this.container, remote, asWebviewUri) + (options?.useAvatars ? remote.provider?.avatarUri : undefined) ?? + getRemoteIconUri(this.container, remote, asWebviewUri) )?.toString(true), context: serializeWebviewItemContext({ webviewItem: 'gitlens:branch+remote', diff --git a/src/plus/webviews/graph/graphWebview.ts b/src/plus/webviews/graph/graphWebview.ts index f567fbc..45718b7 100644 --- a/src/plus/webviews/graph/graphWebview.ts +++ b/src/plus/webviews/graph/graphWebview.ts @@ -28,6 +28,7 @@ import type { } from '../../../commands'; import { parseCommandContext } from '../../../commands/base'; import { GitActions } from '../../../commands/gitCommands.actions'; +import type { Config } from '../../../configuration'; import { configuration } from '../../../configuration'; import { Commands, ContextKeys, CoreGitCommands } from '../../../constants'; import type { Container } from '../../../container'; @@ -185,6 +186,7 @@ export class GraphWebview extends WebviewBase { private _etagSubscription?: number; private _etagRepository?: number; + private _firstSelection = true; private _graph?: GitGraph; private _pendingIpcNotifications = new Map Promise)>(); private _refsMetadata: Map | null | undefined; @@ -192,10 +194,10 @@ export class GraphWebview extends WebviewBase { private _searchCancellation: CancellationTokenSource | undefined; private _selectedId?: string; private _selectedRows: GraphSelectedRows | undefined; - private _repositoryEventsDisposable: Disposable | undefined; - + private _showDetailsView: Config['graph']['showDetailsView']; private _statusBarItem: StatusBarItem | undefined; private _theme: ColorTheme | undefined; + private _repositoryEventsDisposable: Disposable | undefined; private previewBanner?: boolean; private trialBanner?: boolean; @@ -210,6 +212,9 @@ export class GraphWebview extends WebviewBase { 'graphWebview', Commands.ShowGraphPage, ); + + this._showDetailsView = configuration.get('graph.showDetailsView'); + this.disposables.push( configuration.onDidChange(this.onConfigurationChanged, this), once(container.onReady)(() => queueMicrotask(() => this.updateStatusBar())), @@ -260,6 +265,7 @@ export class GraphWebview extends WebviewBase { } override async show(options?: { column?: ViewColumn; preserveFocus?: boolean }, ...args: unknown[]): Promise { + this._firstSelection = true; if (!(await ensurePlusFeaturesEnabled())) return; if (this.container.git.repositoryCount > 1) { @@ -412,7 +418,11 @@ export class GraphWebview extends WebviewBase { setTimeout(() => void setContext(ContextKeys.GraphPageFocused, focused), 0); if (this.selection != null) { - void GitActions.Commit.showDetailsView(this.selection[0], { pin: true, preserveFocus: true }); + void GitActions.Commit.showDetailsView(this.selection[0], { + pin: true, + preserveFocus: true, + preserveVisibility: this._showDetailsView === false, + }); } return; @@ -433,6 +443,10 @@ export class GraphWebview extends WebviewBase { } private onConfigurationChanged(e: ConfigurationChangeEvent) { + if (configuration.changed(e, 'graph.showDetailsView')) { + this._showDetailsView = configuration.get('graph.showDetailsView'); + } + if (configuration.changed(e, 'graph.statusBar.enabled') || configuration.changed(e, 'plusFeatures.enabled')) { this.updateStatusBar(); } @@ -812,7 +826,14 @@ export class GraphWebview extends WebviewBase { if (commits == null) return; - void GitActions.Commit.showDetailsView(commits[0], { pin: true, preserveFocus: true }); + void GitActions.Commit.showDetailsView(commits[0], { + pin: true, + preserveFocus: true, + preserveVisibility: this._firstSelection + ? this._showDetailsView === false + : this._showDetailsView !== 'selection', + }); + this._firstSelection = false; } private _notifyDidChangeStateDebounced: Deferrable | undefined = undefined; diff --git a/src/webviews/apps/settings/partials/commit-graph.html b/src/webviews/apps/settings/partials/commit-graph.html index 46e3a62..6c98c4a 100644 --- a/src/webviews/apps/settings/partials/commit-graph.html +++ b/src/webviews/apps/settings/partials/commit-graph.html @@ -76,6 +76,30 @@
+
+ + +
+ +
+
+
+ +
{ if (options != null) { let commit; @@ -134,6 +135,8 @@ export class CommitDetailsWebviewView extends WebviewViewBase