mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-16 09:35:40 -05:00
Renames quickpicks/quickpicks to quickpicks/common Moves git quick picks into common and other quick pick files
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
'use strict';
|
|
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
|
|
import { BlameAnnotationController } from '../blameAnnotationController';
|
|
import { Commands, EditorCommand } from './common';
|
|
import { Logger } from '../logger';
|
|
|
|
export class ToggleBlameCommand extends EditorCommand {
|
|
|
|
constructor(private annotationController: BlameAnnotationController) {
|
|
super(Commands.ToggleBlame);
|
|
}
|
|
|
|
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, sha?: string): Promise<any> {
|
|
if (editor && editor.document && editor.document.isDirty) return undefined;
|
|
|
|
try {
|
|
if (sha) {
|
|
return this.annotationController.toggleBlameAnnotation(editor, sha);
|
|
}
|
|
|
|
return this.annotationController.toggleBlameAnnotation(editor, editor.selection.active.line);
|
|
}
|
|
catch (ex) {
|
|
Logger.error(ex, 'ToggleBlameCommand');
|
|
return window.showErrorMessage(`Unable to show blame annotations. See output channel for more details`);
|
|
}
|
|
}
|
|
} |