mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 10:03:15 -05:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user