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 May 19, 2024
1 parent 1cc51d9 commit 789696d
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 @@ -2772,6 +2772,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 @@ -378,6 +378,7 @@ export interface GraphConfig {
readonly additionalTypes: GraphMinimapMarkersAdditionalTypes[];
};
readonly highlightRowsOnRefHover: boolean;
readonly useCompactByDefault: boolean;
readonly layout: 'editor' | 'panel';
readonly scrollRowPadding: number;
readonly showDetailsView: 'open' | 'selection' | false;
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 @@ -1770,6 +1770,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 @@ -1851,6 +1855,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 @@ -184,6 +184,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 789696d

Please sign in to comment.