diff --git a/extensions/git/package.json b/extensions/git/package.json index eb1e60e74fc..c251bcfaa00 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -3193,7 +3193,10 @@ "type": "boolean", "default": false, "markdownDescription": "%config.blameEditorDecoration.enabled%", - "scope": "resource" + "scope": "resource", + "tags": [ + "experimental" + ] } } }, diff --git a/extensions/git/src/blame.ts b/extensions/git/src/blame.ts index 09933e93589..ea8163b0a6a 100644 --- a/extensions/git/src/blame.ts +++ b/extensions/git/src/blame.ts @@ -10,6 +10,8 @@ import { Repository } from './repository'; import { throttle } from './decorators'; import { BlameInformation } from './git'; +const notCommittedYetId = '0000000000000000000000000000000000000000'; + function isLineChanged(lineNumber: number, changes: readonly TextEditorDiff[]): boolean { for (const change of changes) { // If the change is a delete, skip it @@ -157,7 +159,7 @@ export class GitBlameController { for (const lineNumber of textEditor.selections.map(s => s.active.line)) { // Check if the line is in an add/edit change if (isLineChanged(lineNumber + 1, diffInformation.diff)) { - decorations.push(this._createDecoration(lineNumber, l10n.t('Uncommitted change'))); + decorations.push(this._createDecoration(lineNumber, l10n.t('Not Committed Yet'))); continue; } @@ -170,8 +172,12 @@ export class GitBlameController { }); if (blameInformation) { - const ago = fromNow(blameInformation.date ?? Date.now(), true, true); - decorations.push(this._createDecoration(lineNumber, `${blameInformation.message ?? ''}, ${blameInformation.authorName ?? ''} (${ago})`)); + if (blameInformation.id === notCommittedYetId) { + decorations.push(this._createDecoration(lineNumber, l10n.t('Not Committed Yet'))); + } else { + const ago = fromNow(blameInformation.date ?? Date.now(), true, true); + decorations.push(this._createDecoration(lineNumber, `${blameInformation.message ?? ''}, ${blameInformation.authorName ?? ''} (${ago})`)); + } } }