Adds blame information in the statusBar

Add new StatusBar settings -- see **Extension Settings** above for details
Renames the `gitlens.codeLens.recentChange.command` & `gitlens.codeLens.authors.command` settings options (to align with command names)
Adds new `gitlens.diffWithPrevious` option to the `gitlens.codeLens.recentChange.command` & `gitlens.codeLens.authors.command` settings
Fixes Diff with Previous when the selection is uncommited
Removes `gitlens.blame.annotation.useCodeActions` setting and behavior
This commit is contained in:
Eric Amodio
2016-09-21 02:02:49 -04:00
parent c4b8637946
commit 834b4904db
12 changed files with 359 additions and 220 deletions

View File

@@ -158,7 +158,8 @@ export default class GitCodeLensProvider implements CodeLensProvider {
switch (this._config.recentChange.command) {
case CodeLensCommand.BlameAnnotate: return this._applyBlameAnnotateCommand<GitRecentChangeCodeLens>(title, lens, blame);
case CodeLensCommand.BlameExplorer: return this._applyBlameExplorerCommand<GitRecentChangeCodeLens>(title, lens, blame);
case CodeLensCommand.GitHistory: return this._applyGitHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame);
case CodeLensCommand.DiffWithPrevious: return this._applyDiffWithPreviousCommand<GitRecentChangeCodeLens>(title, lens, blame);
case CodeLensCommand.GitViewHistory: return this._applyGitHistoryCommand<GitRecentChangeCodeLens>(title, lens, blame);
default: return lens;
}
});
@@ -171,7 +172,8 @@ export default class GitCodeLensProvider implements CodeLensProvider {
switch (this._config.authors.command) {
case CodeLensCommand.BlameAnnotate: return this._applyBlameAnnotateCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.BlameExplorer: return this._applyBlameExplorerCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.GitHistory: return this._applyGitHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.DiffWithPrevious: return this._applyDiffWithPreviousCommand<GitAuthorsCodeLens>(title, lens, blame);
case CodeLensCommand.GitViewHistory: return this._applyGitHistoryCommand<GitAuthorsCodeLens>(title, lens, blame);
default: return lens;
}
});
@@ -195,12 +197,24 @@ export default class GitCodeLensProvider implements CodeLensProvider {
return lens;
}
_applyDiffWithPreviousCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: IGitBlameLines) {
const line = blame.allLines[lens.range.start.line];
const commit = blame.commits.get(line.sha);
lens.command = {
title: title,
command: Commands.DiffWithPrevious,
arguments: [Uri.file(lens.fileName), commit.repoPath, commit.sha, commit.uri, commit.previousSha, commit.previousUri, line.line]
};
return lens;
}
_applyGitHistoryCommand<T extends GitRecentChangeCodeLens | GitAuthorsCodeLens>(title: string, lens: T, blame: IGitBlameLines) {
if (!this._hasGitHistoryExtension) return this._applyBlameExplorerCommand(title, lens, blame);
lens.command = {
title: title,
command: 'git.viewFileHistory',
command: CodeLensCommand.GitViewHistory,
arguments: [Uri.file(lens.fileName)]
};
return lens;