Skip to content

Commit 35ca810

Browse files
committed
Adds customizable code lens strings
1 parent 948a75d commit 35ca810

File tree

5 files changed

+38
-3
lines changed

5 files changed

+38
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
2121
- Adds `Show File Blame Annotations` command (`gitlens.showFileBlame`) - shows the file blame annotations
2222
- Adds `Open File in Remote` command (`gitlens.openFileInRemote`) to the `editor/title` context menu
2323
- Adds `Open Repo in Remote` command (`gitlens.openRepoInRemote`) to the `editor/title` context menu
24+
- Adds `gitlens.strings.*` settings to allow for the customization of certain strings displayed
25+
- Adds `gitlens.theme.*` settings to allow for the theming of certain elements
2426

2527
### Changed
2628
- (BREAKING) Almost all of the GitLens settings have either been renamed, removed, or otherwise changed - see the [README](https://github.com/eamodio/vscode-gitlens/blob/develop/README.md#extension-settings)`

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@ GitLens is highly customizable and provides many configuration settings to allow
271271
|`gitlens.statusBar.format`|Specifies the format of the blame information on the status bar<br />Available tokens<br />`${id}` - commit id<br />`${author}` - commit author<br />`${message}` - commit message<br />`${ago}` - relative commit date (e.g. 1 day ago)<br />`${date}` - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
272272
|`gitlens.statusBar.dateFormat`|Specifies the date format of absolute dates shown in the blame information on the status bar<br />See https://momentjs.com/docs/#/displaying/format/ for valid formats
273273

274+
### Strings Settings
275+
276+
|Name | Description
277+
|-----|------------
278+
|`gitlens.strings.codeLens.unsavedChanges.recentChangeAndAuthors`|Specifies the string to be shown in place of both the `recent change` and `authors` code lens when there are unsaved changes
279+
|`gitlens.strings.codeLens.unsavedChanges.recentChangeOnly`|Specifies the string to be shown in place of the `recent change` code lens when there are unsaved changes
280+
|`gitlens.strings.codeLens.unsavedChanges.authorsOnly`|Specifies the string to be shown in place of the `authors` code lens when there are unsaved changes
281+
274282
### Theme Settings
275283

276284
|Name | Description

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,21 @@
408408
"default": null,
409409
"description": "Specifies the date format of absolute dates shown in the blame information on the status bar. See https://momentjs.com/docs/#/displaying/format/ for valid formats"
410410
},
411+
"gitlens.strings.codeLens.unsavedChanges.recentChangeAndAuthors": {
412+
"type": "string",
413+
"default": "Cannot determine recent change or authors (unsaved changes)",
414+
"description": "Specifies the string to be shown in place of both the `recent change` and `authors` code lens when there are unsaved changes"
415+
},
416+
"gitlens.strings.codeLens.unsavedChanges.recentChangeOnly": {
417+
"type": "string",
418+
"default": "Cannot determine recent change (unsaved changes)",
419+
"description": "Specifies the string to be shown in place of the `recent change` code lens when there are unsaved changes"
420+
},
421+
"gitlens.strings.codeLens.unsavedChanges.authorsOnly": {
422+
"type": "string",
423+
"default": "Cannot determine authors (unsaved changes)",
424+
"description": "Specifies the string to be shown in place of the `authors` code lens when there are unsaved changes"
425+
},
411426
"gitlens.theme.annotations.file.gutter.separateLines": {
412427
"type": "boolean",
413428
"default": true,

src/configuration.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,16 @@ export interface IConfig {
284284
dateFormat: string;
285285
};
286286

287+
strings: {
288+
codeLens: {
289+
unsavedChanges: {
290+
recentChangeAndAuthors: string;
291+
recentChangeOnly: string;
292+
authorsOnly: string;
293+
};
294+
};
295+
};
296+
287297
theme: IThemeConfig;
288298

289299
debug: boolean;

src/gitCodeLensProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,13 @@ export class GitCodeLensProvider implements CodeLensProvider {
237237
let title: string;
238238
if (this._documentIsDirty) {
239239
if (this._config.codeLens.recentChange.enabled && this._config.codeLens.authors.enabled) {
240-
title = 'Cannot determine recent change or authors (unsaved changes)';
240+
title = this._config.strings.codeLens.unsavedChanges.recentChangeAndAuthors;
241241
}
242242
else if (this._config.codeLens.recentChange.enabled) {
243-
title = 'Cannot determine recent change (unsaved changes)';
243+
title = this._config.strings.codeLens.unsavedChanges.recentChangeOnly;
244244
}
245245
else {
246-
title = 'Cannot determine authors (unsaved changes)';
246+
title = this._config.strings.codeLens.unsavedChanges.authorsOnly;
247247
}
248248

249249
lens.command = { title: title } as Command;

0 commit comments

Comments
 (0)