Skip to content

Commit d4c7896

Browse files
committed
Improves the Visual File History experience
- Adds visibility of uncommitted (WIP) changes - Adds ability to choose the base branch or all branches - Adds ability to slice by author or branch, branch slicing is only available when all branches are selected - Adds interactive breadcrumbs for repo, branch, and path - Adds quick scrubbing navigation with a new slider - Refines zoom/pan controls (control+mouse wheel to zoom, mouse wheel to pan) - Adds a scrollbar to the chart for easy panning - Enhances commit interactions, allowing comparison with the working tree (Shift-click) and viewing folder changes Refactors the chart component, state management, and introduces several reusable UI components (breadcrumbs, ref buttons, slider, scroller, etc.).
1 parent 2358518 commit d4c7896

File tree

20 files changed

+2626
-595
lines changed

20 files changed

+2626
-595
lines changed

docs/telemetry-events.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,11 +2005,14 @@ or
20052005

20062006
### timeline/action/openInEditor
20072007

2008-
> Sent when the user changes the period (timeframe) on the Visual History
2008+
> Sent when the user clicks on the "Open in Editor" button on the Visual History
20092009
20102010
```typescript
20112011
{
2012-
'context.period': string,
2012+
'context.itemType': 'file' | 'folder',
2013+
'context.period': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`,
2014+
'context.showAllBranches': boolean,
2015+
'context.sliceBy': 'author' | 'branch',
20132016
'context.webview.host': 'editor' | 'view',
20142017
'context.webview.id': string,
20152018
'context.webview.instanceId': string,
@@ -2023,41 +2026,51 @@ or
20232026
20242027
```typescript
20252028
{
2026-
'context.period': string,
2029+
'context.itemType': 'file' | 'folder',
2030+
'context.period': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`,
2031+
'context.showAllBranches': boolean,
2032+
'context.sliceBy': 'author' | 'branch',
20272033
'context.webview.host': 'editor' | 'view',
20282034
'context.webview.id': string,
20292035
'context.webview.instanceId': string,
20302036
'context.webview.type': string
20312037
}
20322038
```
20332039

2034-
### timeline/editor/changed
2040+
### timeline/config/changed
20352041

2036-
> Sent when the editor changes on the Visual History
2042+
> Sent when the user changes the configuration of the Visual History (e.g. period, show all branches, etc)
20372043
20382044
```typescript
20392045
{
2040-
'context.period': string,
2046+
'context.itemType': 'file' | 'folder',
2047+
'context.period': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`,
2048+
'context.showAllBranches': boolean,
2049+
'context.sliceBy': 'author' | 'branch',
20412050
'context.webview.host': 'editor' | 'view',
20422051
'context.webview.id': string,
20432052
'context.webview.instanceId': string,
2044-
'context.webview.type': string
2053+
'context.webview.type': string,
2054+
'period': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`,
2055+
'showAllBranches': boolean,
2056+
'sliceBy': 'author' | 'branch'
20452057
}
20462058
```
20472059

2048-
### timeline/period/changed
2060+
### timeline/editor/changed
20492061

2050-
> Sent when the user changes the period (timeframe) on the Visual History
2062+
> Sent when the editor changes on the Visual History
20512063
20522064
```typescript
20532065
{
2054-
'context.period': string,
2066+
'context.itemType': 'file' | 'folder',
2067+
'context.period': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`,
2068+
'context.showAllBranches': boolean,
2069+
'context.sliceBy': 'author' | 'branch',
20552070
'context.webview.host': 'editor' | 'view',
20562071
'context.webview.id': string,
20572072
'context.webview.instanceId': string,
2058-
'context.webview.type': string,
2059-
'period.new': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`,
2060-
'period.old': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`
2073+
'context.webview.type': string
20612074
}
20622075
```
20632076

@@ -2082,7 +2095,10 @@ or
20822095
{
20832096
'context.config.allowMultiple': boolean,
20842097
'context.config.queryLimit': number,
2085-
'context.period': string,
2098+
'context.itemType': 'file' | 'folder',
2099+
'context.period': 'all' | `${number}|D` | `${number}|M` | `${number}|Y`,
2100+
'context.showAllBranches': boolean,
2101+
'context.sliceBy': 'author' | 'branch',
20862102
'context.webview.host': 'editor' | 'view',
20872103
'context.webview.id': string,
20882104
'context.webview.instanceId': string,

src/constants.telemetry.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { Subscription, SubscriptionAccount } from './plus/gk/models/subscri
1111
import type { Flatten } from './system/object';
1212
import type { WalkthroughContextKeys } from './telemetry/walkthroughStateProvider';
1313
import type { GraphColumnConfig } from './webviews/plus/graph/protocol';
14-
import type { Period } from './webviews/plus/timeline/protocol';
14+
import type { TimelineItemType, TimelinePeriod, TimelineSliceBy } from './webviews/plus/timeline/protocol';
1515

1616
export declare type AttributeValue =
1717
| string
@@ -257,14 +257,14 @@ export interface TelemetryEvents extends WebviewShowAbortedEvents, WebviewShownE
257257

258258
/** Sent when the Visual History is shown */
259259
'timeline/shown': TimelineShownEvent;
260-
/** Sent when the user changes the period (timeframe) on the Visual History */
260+
/** Sent when the user clicks on the "Open in Editor" button on the Visual History */
261261
'timeline/action/openInEditor': TimelineContextEventData;
262262
/** Sent when the editor changes on the Visual History */
263263
'timeline/editor/changed': TimelineContextEventData;
264-
/** Sent when the user changes the period (timeframe) on the Visual History */
265-
'timeline/period/changed': TimelinePeriodChangedEvent;
266264
/** Sent when the user selects (clicks on) a commit on the Visual History */
267265
'timeline/commit/selected': TimelineContextEventData;
266+
/** Sent when the user changes the configuration of the Visual History (e.g. period, show all branches, etc) */
267+
'timeline/config/changed': TimelineConfigChangedEvent;
268268

269269
/** Sent when a "tracked feature" is interacted with, today that is only when webview/webviewView/custom editor is shown */
270270
'usage/track': UsageTrackEvent;
@@ -864,7 +864,10 @@ export interface SubscriptionEventDataWithPrevious
864864
Partial<SubscriptionPreviousEventData> {}
865865

866866
type TimelineContextEventData = WebviewTelemetryContext & {
867-
'context.period': string | undefined;
867+
'context.itemType': TimelineItemType | undefined;
868+
'context.period': TimelinePeriod | undefined;
869+
'context.showAllBranches': boolean | undefined;
870+
'context.sliceBy': TimelineSliceBy | undefined;
868871
};
869872
export type TimelineTelemetryContext = TimelineContextEventData;
870873

@@ -873,9 +876,10 @@ export type TimelineShownTelemetryContext = TimelineShownEventData;
873876

874877
type TimelineShownEvent = WebviewShownEventData & TimelineShownEventData;
875878

876-
interface TimelinePeriodChangedEvent extends TimelineContextEventData {
877-
'period.old': Period | undefined;
878-
'period.new': Period;
879+
interface TimelineConfigChangedEvent extends TimelineContextEventData {
880+
period: TimelinePeriod;
881+
showAllBranches: boolean;
882+
sliceBy: TimelineSliceBy;
879883
}
880884

881885
interface UsageTrackEvent {

src/env/node/git/sub-providers/commits.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,10 @@ export class CommitsGitSubProvider implements GitCommitsSubProvider {
931931
const parser = getShaLogParser();
932932
const args = [...parser.arguments];
933933

934+
if (options?.all) {
935+
args.push(`--all`);
936+
}
937+
934938
const ordering = options?.ordering ?? configuration.get('advanced.commitOrdering');
935939
if (ordering) {
936940
args.push(`--${ordering}-order`);

src/git/gitProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ export interface GitLogForPathOptions extends Omit<GitLogOptions, 'stashes'> {
305305
}
306306

307307
export interface GitLogShasOptions extends GitLogOptionsBase {
308+
all?: boolean;
308309
authors?: GitUser[];
309310
merges?: boolean | 'first-parent';
310311
pathOrUri?: string | Uri;

src/webviews/apps/plus/timeline/components/chart.css.ts

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,62 @@ import { css } from 'lit';
22

33
export const timelineChartStyles = css`
44
:host {
5-
display: block;
6-
position: relative;
5+
display: flex;
6+
flex-direction: column;
77
width: 100%;
88
height: 100%;
9+
10+
--scroller-track-top: unset;
11+
--scroller-track-left: 0;
12+
--scroller-track-width: 100%;
13+
--scroller-thumb-height: 0.6rem;
14+
--scroller-track-height: 1.2rem;
915
}
1016
11-
#chart {
12-
position: absolute !important;
17+
gl-chart-scroller {
18+
display: flex;
19+
flex-direction: column;
1320
height: 100%;
1421
width: 100%;
22+
min-height: 0;
23+
}
24+
25+
gl-chart-scroller::part(track) {
26+
--track-top: var(--scroller-track-top);
27+
--track-left: var(--scroller-track-left);
28+
--track-width: var(--scroller-track-width);
29+
--track-height: var(--scroller-track-height);
30+
--thumb-height: var(--scroller-thumb-height);
31+
}
32+
33+
#chart {
34+
flex: 1;
35+
width: 100%;
36+
height: 100%;
37+
min-height: 0;
38+
}
39+
40+
footer {
41+
flex: 0 0 auto;
42+
display: flex;
43+
align-items: center;
44+
margin: 0 1rem 0.4rem 1rem;
45+
gap: 0.8rem;
46+
}
47+
48+
gl-chart-slider {
49+
flex: 1 0 auto;
50+
margin-left: 1.4rem;
1551
}
1652
17-
/* :host-context(:host[placement='view']) #chart {
18-
height: calc(100% - 0.4rem);
19-
width: calc(100% + 6.9rem);
20-
left: -3.5rem;
21-
bottom: 0.3rem;
22-
} */
53+
gl-commit-sha {
54+
color: var(--color-foreground--75);
55+
text-align: right;
56+
min-width: 7.5rem; /* Ugly but stops the text from jumping around */
57+
}
2358
2459
.bb svg {
25-
font: 10px sans-serif;
60+
font: 10px var(--font-family);
2661
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
2762
}
2863
@@ -45,7 +80,6 @@ export const timelineChartStyles = css`
4580
.bb .bb-button {
4681
user-select: none;
4782
fill: var(--color-view-foreground);
48-
font-size: 11px;
4983
}
5084
5185
.bb .bb-event-rects,
@@ -66,6 +100,10 @@ export const timelineChartStyles = css`
66100
shape-rendering: crispEdges;
67101
}
68102
103+
.bb .bb-legend-item text {
104+
fill: var(--color-foreground--85);
105+
}
106+
69107
.bb .bb-legend-item-tile {
70108
stroke-width: 2px;
71109
transform: translate(0, 1px);
@@ -233,7 +271,7 @@ export const timelineChartStyles = css`
233271
}
234272
235273
.bb .bb-title {
236-
font: 14px sans-serif;
274+
font: 14px var(--font-family);
237275
}
238276
239277
.bb .bb-tooltip-container {
@@ -349,6 +387,21 @@ export const timelineChartStyles = css`
349387
font-weight: 600;
350388
}
351389
390+
.bb-tooltip .branches {
391+
white-space: nowrap;
392+
overflow: hidden;
393+
text-overflow: ellipsis;
394+
/* font-family: var(--vscode-editor-font-family); */
395+
}
396+
397+
.bb-tooltip .sha {
398+
/* background: var(--vscode-textCodeBlock-background);
399+
border-radius: 0.3rem; */
400+
/* padding: 0.1rem 0.4rem 0.2rem 0.4rem; */
401+
font-family: var(--vscode-editor-font-family);
402+
margin-right: 0.4rem;
403+
}
404+
352405
.bb-tooltip .additions {
353406
color: var(--vscode-gitDecoration-addedResourceForeground);
354407
}
@@ -390,6 +443,10 @@ export const timelineChartStyles = css`
390443
white-space: pre-line;
391444
}
392445
446+
:host-context(:host[placement='editor']) .bb-axis-y .tick text {
447+
fill: var(--color-foreground--85);
448+
}
449+
393450
:host-context(:host[placement='view']) .bb-axis-y .tick text {
394451
transform: translate(0, 0.4rem);
395452
font-family: codicon;

0 commit comments

Comments
 (0)