mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 02:01:43 -05:00
Git - add commands to toggle git blame editor decoration/status bar item (#238302)
This commit is contained in:
@@ -933,6 +933,16 @@
|
||||
"command": "git.copyCommitMessage",
|
||||
"title": "%command.timelineCopyCommitMessage%",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.blame.toggleEditorDecoration",
|
||||
"title": "%command.blameToggleEditorDecoration%",
|
||||
"category": "Git"
|
||||
},
|
||||
{
|
||||
"command": "git.blame.toggleStatusBarItem",
|
||||
"title": "%command.blameToggleStatusBarItem%",
|
||||
"category": "Git"
|
||||
}
|
||||
],
|
||||
"continueEditSession": [
|
||||
|
||||
@@ -128,6 +128,8 @@
|
||||
"command.graphCherryPick": "Cherry Pick",
|
||||
"command.graphDeleteBranch": "Delete Branch",
|
||||
"command.graphDeleteTag": "Delete Tag",
|
||||
"command.blameToggleEditorDecoration": "Toggle Git Blame Editor Decoration",
|
||||
"command.blameToggleStatusBarItem": "Toggle Git Blame Status Bar Item",
|
||||
"command.api.getRepositories": "Get Repositories",
|
||||
"command.api.getRepositoryState": "Get Repository State",
|
||||
"command.api.getRemoteSources": "Get Remote Sources",
|
||||
|
||||
@@ -4356,6 +4356,23 @@ export class CommandCenter {
|
||||
env.clipboard.writeText(content);
|
||||
}
|
||||
|
||||
@command('git.blame.toggleEditorDecoration')
|
||||
toggleBlameEditorDecoration(): void {
|
||||
this._toggleBlameSetting('blame.editorDecoration.enabled');
|
||||
}
|
||||
|
||||
@command('git.blame.toggleStatusBarItem')
|
||||
toggleBlameStatusBarItem(): void {
|
||||
this._toggleBlameSetting('blame.statusBarItem.enabled');
|
||||
}
|
||||
|
||||
private _toggleBlameSetting(setting: string): void {
|
||||
const config = workspace.getConfiguration('git');
|
||||
const enabled = config.get<boolean>(setting) === true;
|
||||
|
||||
config.update(setting, !enabled, true);
|
||||
}
|
||||
|
||||
private createCommand(id: string, key: string, method: Function, options: ScmCommandOptions): (...args: any[]) => any {
|
||||
const result = (...args: any[]) => {
|
||||
let result: Promise<any>;
|
||||
|
||||
Reference in New Issue
Block a user