Skip to content

Commit

Permalink
Adds feature #3297 - Setting for compact graph
Browse files Browse the repository at this point in the history
  • Loading branch information
TJohnsonSE committed Jun 16, 2024
1 parent 6d6a272 commit fcc9a27
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2814,6 +2814,13 @@
"scope": "window",
"order": 27
},
"gitlens.graph.useCompactByDefault": {
"type": "boolean",
"default": false,
"markdownDescription": "Specifies whether to default to using the compact graph layout in the _Commit Graph_",
"scope": "window",
"order": 28
},
"gitlens.graph.commitOrdering": {
"type": "string",
"default": "date",
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ export interface GraphConfig {
readonly dimMergeCommits: boolean;
readonly highlightRowsOnRefHover: boolean;
readonly layout: 'editor' | 'panel';
readonly useCompactByDefault: boolean;
readonly minimap: {
readonly enabled: boolean;
readonly dataType: 'commits' | 'lines';
Expand Down
5 changes: 5 additions & 0 deletions src/plus/webviews/graph/graphWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,10 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
}
}

if (this._graph == undefined && this.getComponentConfig().useCompactByDefault && this._firstSelection) {
void this.setColumnMode('graph', 'compact');
}

return columnsSettings;
}

Expand Down Expand Up @@ -1842,6 +1846,7 @@ export class GraphWebviewProvider implements WebviewProvider<State, State, Graph
showGhostRefsOnRowHover: configuration.get('graph.showGhostRefsOnRowHover'),
showRemoteNamesOnRefs: configuration.get('graph.showRemoteNames'),
idLength: configuration.get('advanced.abbreviatedShaLength'),
useCompactByDefault: configuration.get('graph.useCompactByDefault'),
};
return config;
}
Expand Down
1 change: 1 addition & 0 deletions src/plus/webviews/graph/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ export interface GraphComponentConfig {
showGhostRefsOnRowHover?: boolean;
showRemoteNamesOnRefs?: boolean;
idLength?: number;
useCompactByDefault?: boolean;
}

export interface GraphColumnConfig {
Expand Down
12 changes: 12 additions & 0 deletions src/webviews/apps/settings/partials/commit-graph.html
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ <h2>
</p>
</div>

<div class="setting">
<div class="setting__input">
<input
id="graph.useCompactByDefault"
name="graph.useCompactByDefault"
type="checkbox"
data-setting
/>
<label for="graph.useCompactByDefault">Use compact graph view by default</label>
</div>
</div>

<div class="setting">
<div class="setting__input">
<input id="graph.avatars" name="graph.avatars" type="checkbox" data-setting />
Expand Down

0 comments on commit fcc9a27

Please sign in to comment.