Adds support for git commands on scheme=git

Rewrites blame annotation controller and provider - fixes whitespace issues, reduces overhead, and provides better performance
Rewrites status bar blame support - reduces overhead and provides better performance
Adds showFileHistory command to status bar
Renames showHistory to showFileHistory
Fixes log to use iso 8601 for dates
This commit is contained in:
Eric Amodio
2016-11-12 01:25:42 -05:00
parent 7ace9cb152
commit 638a6dc838
28 changed files with 592 additions and 259 deletions

View File

@@ -3,30 +3,23 @@ import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import BlameAnnotationController from '../blameAnnotationController';
import { EditorCommand } from './commands';
import { Commands } from '../constants';
import GitProvider from '../gitProvider';
import { Logger } from '../logger';
export default class ToggleBlameCommand extends EditorCommand {
constructor(private git: GitProvider, private annotationController: BlameAnnotationController) {
constructor(private annotationController: BlameAnnotationController) {
super(Commands.ToggleBlame);
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, sha?: string) {
if (sha) {
return this.annotationController.toggleBlameAnnotation(editor, sha);
}
if (!(uri instanceof Uri)) {
if (!editor.document) return undefined;
uri = editor.document.uri;
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri, sha?: string): Promise<any> {
try {
const blame = await this.git.getBlameForLine(uri.fsPath, editor.selection.active.line);
return this.annotationController.toggleBlameAnnotation(editor, blame && blame.commit.sha);
if (sha) {
return this.annotationController.toggleBlameAnnotation(editor, sha);
}
return this.annotationController.toggleBlameAnnotation(editor, editor.selection.active.line);
}
catch (ex) {
Logger.error('[GitLens.ToggleBlameCommand]', `getBlameForLine(${editor.selection.active.line})`, ex);
Logger.error('GitLens.ToggleBlameCommand', ex);
return window.showErrorMessage(`Unable to show blame annotations. See output channel for more details`);
}
}