diff --git a/extensions/git/package.json b/extensions/git/package.json index acda1837a38..256e176065f 100644 --- a/extensions/git/package.json +++ b/extensions/git/package.json @@ -3838,6 +3838,11 @@ "default": "${authorName} (${authorDateAgo})", "markdownDescription": "%config.blameStatusBarItem.template%" }, + "git.blame.editorDecoration.disablePreview": { + "type": "boolean", + "default": false, + "markdownDescription": "%config.blameEditorDecoration.disablePreview%" + }, "git.commitShortHashLength": { "type": "number", "default": 7, diff --git a/extensions/git/package.nls.json b/extensions/git/package.nls.json index 385fce3172a..1a06a538439 100644 --- a/extensions/git/package.nls.json +++ b/extensions/git/package.nls.json @@ -301,6 +301,7 @@ "config.similarityThreshold": "Controls the threshold of the similarity index (the amount of additions/deletions compared to the file's size) for changes in a pair of added/deleted files to be considered a rename. **Note:** Requires Git version `2.18.0` or later.", "config.blameEditorDecoration.enabled": "Controls whether to show blame information in the editor using editor decorations.", "config.blameEditorDecoration.template": "Template for the blame information editor decoration. Supported variables:\n\n* `hash`: Commit hash\n\n* `hashShort`: First N characters of the commit hash according to `#git.commitShortHashLength#`\n\n* `subject`: First line of the commit message\n\n* `authorName`: Author name\n\n* `authorEmail`: Author email\n\n* `authorDate`: Author date\n\n* `authorDateAgo`: Time difference between now and the author date\n\n", + "config.blameEditorDecoration.disablePreview": "Controls whether to disable the preview when hovering over the editor decoration.", "config.blameStatusBarItem.enabled": "Controls whether to show blame information in the status bar.", "config.blameStatusBarItem.template": "Template for the blame information status bar item. Supported variables:\n\n* `hash`: Commit hash\n\n* `hashShort`: First N characters of the commit hash according to `#git.commitShortHashLength#`\n\n* `subject`: First line of the commit message\n\n* `authorName`: Author name\n\n* `authorEmail`: Author email\n\n* `authorDate`: Author date\n\n* `authorDateAgo`: Time difference between now and the author date\n\n", "config.commitShortHashLength": "Controls the length of the commit short hash.", diff --git a/extensions/git/src/blame.ts b/extensions/git/src/blame.ts index 96f5dec14a1..78d9ab3622b 100644 --- a/extensions/git/src/blame.ts +++ b/extensions/git/src/blame.ts @@ -578,7 +578,8 @@ class GitBlameEditorDecoration implements HoverProvider { private _onDidChangeConfiguration(e?: ConfigurationChangeEvent): void { if (e && !e.affectsConfiguration('git.commitShortHashLength') && - !e.affectsConfiguration('git.blame.editorDecoration.template')) { + !e.affectsConfiguration('git.blame.editorDecoration.template') && + !e.affectsConfiguration('git.blame.editorDecoration.disablePreview')) { return; } @@ -642,7 +643,10 @@ class GitBlameEditorDecoration implements HoverProvider { private _registerHoverProvider(): void { this._hoverDisposable?.dispose(); - if (window.activeTextEditor && isResourceSchemeSupported(window.activeTextEditor.document.uri)) { + const config = workspace.getConfiguration('git'); + const disablePreview = config.get('blame.editorDecoration.disablePreview', false); + + if (!disablePreview && window.activeTextEditor && isResourceSchemeSupported(window.activeTextEditor.document.uri)) { this._hoverDisposable = languages.registerHoverProvider({ pattern: window.activeTextEditor.document.uri.fsPath }, this);