Skip to content

Commit fcc9a27

Browse files
committed
Adds feature #3297 - Setting for compact graph
1 parent 6d6a272 commit fcc9a27

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,13 @@
28142814
"scope": "window",
28152815
"order": 27
28162816
},
2817+
"gitlens.graph.useCompactByDefault": {
2818+
"type": "boolean",
2819+
"default": false,
2820+
"markdownDescription": "Specifies whether to default to using the compact graph layout in the _Commit Graph_",
2821+
"scope": "window",
2822+
"order": 28
2823+
},
28172824
"gitlens.graph.commitOrdering": {
28182825
"type": "string",
28192826
"default": "date",

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ export interface GraphConfig {
380380
readonly dimMergeCommits: boolean;
381381
readonly highlightRowsOnRefHover: boolean;
382382
readonly layout: 'editor' | 'panel';
383+
readonly useCompactByDefault: boolean;
383384
readonly minimap: {
384385
readonly enabled: boolean;
385386
readonly dataType: 'commits' | 'lines';

src/plus/webviews/graph/graphWebview.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,10 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
17601760
}
17611761
}
17621762

1763+
if (this._graph == undefined && this.getComponentConfig().useCompactByDefault && this._firstSelection) {
1764+
void this.setColumnMode('graph', 'compact');
1765+
}
1766+
17631767
return columnsSettings;
17641768
}
17651769

@@ -1842,6 +1846,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
18421846
showGhostRefsOnRowHover: configuration.get('graph.showGhostRefsOnRowHover'),
18431847
showRemoteNamesOnRefs: configuration.get('graph.showRemoteNames'),
18441848
idLength: configuration.get('advanced.abbreviatedShaLength'),
1849+
useCompactByDefault: configuration.get('graph.useCompactByDefault'),
18451850
};
18461851
return config;
18471852
}

src/plus/webviews/graph/protocol.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export interface GraphComponentConfig {
185185
showGhostRefsOnRowHover?: boolean;
186186
showRemoteNamesOnRefs?: boolean;
187187
idLength?: number;
188+
useCompactByDefault?: boolean;
188189
}
189190

190191
export interface GraphColumnConfig {

src/webviews/apps/settings/partials/commit-graph.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,18 @@ <h2>
212212
</p>
213213
</div>
214214

215+
<div class="setting">
216+
<div class="setting__input">
217+
<input
218+
id="graph.useCompactByDefault"
219+
name="graph.useCompactByDefault"
220+
type="checkbox"
221+
data-setting
222+
/>
223+
<label for="graph.useCompactByDefault">Use compact graph view by default</label>
224+
</div>
225+
</div>
226+
215227
<div class="setting">
216228
<div class="setting__input">
217229
<input id="graph.avatars" name="graph.avatars" type="checkbox" data-setting />

0 commit comments

Comments
 (0)