mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-17 01:35:37 -05:00
Adds details hover to recent changes annotations
This commit is contained in:
@@ -34,15 +34,27 @@ export class RecentChangesAnnotationProvider extends AnnotationProviderBase {
|
||||
if (change.state === 'unchanged') continue;
|
||||
|
||||
let endingIndex = 0;
|
||||
if (cfg.hover.details || cfg.hover.changes) {
|
||||
endingIndex = cfg.hover.wholeLine ? endOfLineIndex : this.editor.document.lineAt(count).firstNonWhitespaceCharacterIndex;
|
||||
}
|
||||
|
||||
const range = this.editor.document.validateRange(new Range(new Position(count, 0), new Position(count, endingIndex)));
|
||||
|
||||
if (cfg.hover.details) {
|
||||
decorators.push({
|
||||
hoverMessage: CommitFormatter.toHoverAnnotation(commit),
|
||||
range: range
|
||||
} as DecorationOptions);
|
||||
}
|
||||
|
||||
let message: string | undefined = undefined;
|
||||
if (cfg.hover.changes) {
|
||||
message = CommitFormatter.toHoverDiff(commit, chunk.previous[count], change);
|
||||
endingIndex = cfg.hover.wholeLine ? endOfLineIndex : this.editor.document.lineAt(count).firstNonWhitespaceCharacterIndex;
|
||||
}
|
||||
|
||||
decorators.push({
|
||||
hoverMessage: message,
|
||||
range: this.editor.document.validateRange(new Range(new Position(count, 0), new Position(count, endingIndex)))
|
||||
range: range
|
||||
} as DecorationOptions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +237,7 @@ export interface IConfig {
|
||||
|
||||
recentChanges: {
|
||||
hover: {
|
||||
details: boolean;
|
||||
changes: boolean;
|
||||
wholeLine: boolean;
|
||||
};
|
||||
|
||||
@@ -361,6 +361,16 @@ export class CurrentLineController extends Disposable {
|
||||
}
|
||||
case FileAnnotationType.RecentChanges: {
|
||||
const cfgChanges = this._config.annotations.file.recentChanges.hover;
|
||||
if (cfgChanges.details) {
|
||||
if (cfgChanges.wholeLine) {
|
||||
// Avoid double annotations if we are showing the whole-file hover blame annotations
|
||||
showDetails = false;
|
||||
}
|
||||
else {
|
||||
showDetailsInStartingWhitespace = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (cfgChanges.changes) {
|
||||
if (cfgChanges.wholeLine) {
|
||||
// Avoid double annotations if we are showing the whole-file hover blame annotations
|
||||
|
||||
Reference in New Issue
Block a user