From 5a112277de6719896b70f5efd05267313e58247b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Thu, 22 Sep 2022 00:16:16 -0400 Subject: [PATCH] Respects `renderIndentGuides` setting Updates on configuration changes --- src/webviews/apps/commitDetails/commitDetails.ts | 2 +- .../apps/shared/components/list/list-item.ts | 10 ++++- .../commitDetails/commitDetailsWebviewView.ts | 46 ++++++++++++++++++++-- src/webviews/commitDetails/protocol.ts | 2 + 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/src/webviews/apps/commitDetails/commitDetails.ts b/src/webviews/apps/commitDetails/commitDetails.ts index 6036783..cb5723e 100644 --- a/src/webviews/apps/commitDetails/commitDetails.ts +++ b/src/webviews/apps/commitDetails/commitDetails.ts @@ -360,7 +360,7 @@ export class CommitDetailsApp extends App> { $el.innerHTML = `
  • - + ${flatTree .map(({ level, item }) => { if (item.name === '') { diff --git a/src/webviews/apps/shared/components/list/list-item.ts b/src/webviews/apps/shared/components/list/list-item.ts index ec6d883..c31ccd7 100644 --- a/src/webviews/apps/shared/components/list/list-item.ts +++ b/src/webviews/apps/shared/components/list/list-item.ts @@ -125,12 +125,18 @@ const styles = css` content: ''; position: absolute; height: 2.2rem; - border-left: 1px solid var(--vscode-list-deemphasizedForeground); + border-left: 1px solid transparent; top: 50%; transform: translate(-50%, -50%); left: 0.8rem; width: 0.1rem; - opacity: 0.5; + transition: border-color 0.1s linear; + } + + :host-context(.indentGuides-always) .node--connector::before, + :host-context(.indentGuides-onHover:focus-within) .node--connector::before, + :host-context(.indentGuides-onHover:hover) .node--connector::before { + border-color: var(--vscode-tree-indentGuidesStroke); } .text { diff --git a/src/webviews/commitDetails/commitDetailsWebviewView.ts b/src/webviews/commitDetails/commitDetailsWebviewView.ts index 856eebd..a68b123 100644 --- a/src/webviews/commitDetails/commitDetailsWebviewView.ts +++ b/src/webviews/commitDetails/commitDetailsWebviewView.ts @@ -1,4 +1,9 @@ -import type { CancellationToken, TreeViewSelectionChangeEvent, TreeViewVisibilityChangeEvent } from 'vscode'; +import type { + CancellationToken, + ConfigurationChangeEvent, + TreeViewSelectionChangeEvent, + TreeViewVisibilityChangeEvent, +} from 'vscode'; import { CancellationTokenSource, Disposable, env, Uri, window } from 'vscode'; import { executeGitCommand, GitActions } from '../../commands/gitCommands.actions'; import { configuration } from '../../configuration'; @@ -16,6 +21,7 @@ import type { GitRevisionReference } from '../../git/models/reference'; import { Logger } from '../../logger'; import type { ShowCommitInGraphCommandArgs } from '../../plus/webviews/graph/graphWebview'; import { executeCommand } from '../../system/command'; +import type { DateTimeFormat } from '../../system/date'; import { debug, getLogScope } from '../../system/decorators/log'; import type { Deferrable } from '../../system/function'; import { debounce } from '../../system/function'; @@ -58,6 +64,9 @@ interface Context { pullRequest: PullRequest | undefined; // commits: GitCommit[] | undefined; + dateFormat: DateTimeFormat | string; + // indent: number; + indentGuides: 'none' | 'onHover' | 'always'; } export class CommitDetailsWebviewView extends WebviewViewBase> { @@ -83,7 +92,15 @@ export class CommitDetailsWebviewView extends WebviewViewBase