Skip to content

Commit

Permalink
Closes #601 - adds setting to control relative date markers
Browse files Browse the repository at this point in the history
  • Loading branch information
eamodio committed Dec 21, 2018
1 parent fa2e6be commit 7e08386
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ See also [View Settings](#view-settings- 'Jump to the View settings')
| `gitlens.views.commitFormat` | Specifies the format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}`&mdash; commit id<br />`${author}` &mdash; commit author<br />`${message}`&mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}`&mdash; formatted commit date (format specified by`gitlens.statusBar.dateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}`&mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.commitDescriptionFormat` | Specifies the description format of committed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}`&mdash; commit id<br />`${author}` &mdash; commit author<br />`${message}`&mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}`&mdash; formatted commit date (format specified by`gitlens.statusBar.dateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}`&mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
| `gitlens.views.defaultItemLimit` | Specifies the default number of items to show in a view list. Use 0 to specify no limit |
| `gitlens.views.showRelativeDateMarkers` | Specifies whether to show relative date markers (_Less than a week ago_, _Over a week ago_, _Over a month ago_, etc) on revision (commit) histories in the views |
| `gitlens.views.stashFileFormat` | Specifies the format of a stashed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.stashFileDescriptionFormat` | Specifies the description format of a stashed file in the views<br /><br />Available tokens<br />`${directory}` &mdash; directory name<br />`${file}` &mdash; file name<br />`${filePath}` &mdash; formatted file name and path<br />`${path}` &mdash; full file path |
| `gitlens.views.stashFormat` | Specifies the format of stashed changes in the views. See the [GitLens docs](https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting) for advanced formatting<br /><br />Available tokens<br />`${id}` &mdash; commit id<br />`${author}` &mdash; commit author<br />`${message}` &mdash; commit message<br />`${ago}` &mdash; relative commit date (e.g. 1 day ago)<br />`${date}`&mdash; formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br />`${agoOrDate}` &mdash; commit date specified by `gitlens.defaultDateStyle`<br />`${authorAgo}` &mdash; commit author, relative commit date<br />`${authorAgoOrDate}` &mdash; commit author, commit date specified by `gitlens.defaultDateStyle` |
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,12 @@
"markdownDescription": "Specifies where to show the _Search Commits_ view",
"scope": "window"
},
"gitlens.views.showRelativeDateMarkers": {
"type": "boolean",
"default": true,
"markdownDescription": "Specifies whether to show relative date markers (_Less than a week ago_, _Over a week ago_, _Over a month ago_, etc) on revision (commit) histories in the views",
"scope": "window"
},
"gitlens.views.stashFileFormat": {
"type": "string",
"default": "${file}",
Expand Down
1 change: 1 addition & 0 deletions src/ui/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ export interface ViewsConfig {
lineHistory: LineHistoryViewConfig;
repositories: RepositoriesViewConfig;
search: SearchViewConfig;
showRelativeDateMarkers: boolean;
stashFileDescriptionFormat: string;
stashFileFormat: string;
stashDescriptionFormat: string;
Expand Down
4 changes: 4 additions & 0 deletions src/views/nodes/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export function* insertDateMarkers<T extends ViewNode & { commit: GitLogCommit }
parent: ViewNode,
skip?: number
): Iterable<ViewNode> {
if (!parent.view.config.showRelativeDateMarkers) {
return yield* iterable;
}

let index = skip || 0;
let time = undefined;
const now = Date.now();
Expand Down

0 comments on commit 7e08386

Please sign in to comment.