Skip to content

Commit 286da64

Browse files
committed
Stops related commit highlighting on initial blame
1 parent 3e41655 commit 286da64

File tree

5 files changed

+38
-16
lines changed

5 files changed

+38
-16
lines changed

src/annotations/annotationProvider.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ export abstract class AnnotationProviderBase implements Disposable {
163163
this.status = AnnotationStatus.Computed;
164164
if (editor === window.activeTextEditor) {
165165
await setCommandContext(CommandContext.AnnotationStatus, this.status);
166-
await this.selection(editor.selection.active.line);
167166
}
168167
}
169168

src/annotations/blameAnnotationProvider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from 'vscode';
1313
import { Container } from '../container';
1414
import { GitBlame, GitCommit, GitUri } from '../git/gitService';
15-
import { Arrays, Iterables } from '../system';
15+
import { Arrays, Iterables, log } from '../system';
1616
import { GitDocumentState, TrackedDocument } from '../trackers/gitDocumentTracker';
1717
import { AnnotationProviderBase } from './annotationProvider';
1818
import { Annotations, ComputedHeatmap } from './annotations';
@@ -58,6 +58,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
5858
return super.onReset(changes);
5959
}
6060

61+
@log({ args: false })
6162
async selection(shaOrLine?: string | number, blame?: GitBlame) {
6263
if (!this.highlightDecoration) return;
6364

@@ -106,6 +107,7 @@ export abstract class BlameAnnotationProviderBase extends AnnotationProviderBase
106107
return blame;
107108
}
108109

110+
@log({ args: false })
109111
protected getComputedHeatmap(blame: GitBlame): ComputedHeatmap {
110112
const dates = [];
111113

src/annotations/gutterBlameAnnotationProvider.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@ import { GlyphChars } from '../constants';
55
import { Container } from '../container';
66
import { CommitFormatOptions, GitBlameCommit } from '../git/gitService';
77
import { Logger } from '../logger';
8-
import { Objects, Strings } from '../system';
8+
import { log, Objects, Strings } from '../system';
99
import { Annotations } from './annotations';
1010
import { BlameAnnotationProviderBase } from './blameAnnotationProvider';
1111

1212
export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
13+
@log()
1314
async onProvideAnnotation(shaOrLine?: string | number, type?: FileAnnotationType): Promise<boolean> {
15+
const cc = Logger.getCorrelationContext();
16+
1417
this.annotationType = FileAnnotationType.Blame;
1518

1619
const blame = await this.getBlame();
1720
if (blame === undefined) return false;
1821

19-
const start = process.hrtime();
22+
let start = process.hrtime();
2023

2124
const cfg = Container.config.blame;
2225

@@ -131,7 +134,11 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
131134
decorationsMap[l.sha] = gutter;
132135
}
133136

137+
Logger.log(cc, `${Strings.getDurationMilliseconds(start)} ms to compute gutter blame annotations`);
138+
134139
if (this.decorations.length) {
140+
start = process.hrtime();
141+
135142
this.editor.setDecorations(this.decoration!, this.decorations);
136143

137144
if (avatars) {
@@ -141,12 +148,11 @@ export class GutterBlameAnnotationProvider extends BlameAnnotationProviderBase {
141148
this.editor.setDecorations(d.decoration, d.ranges);
142149
}
143150
}
144-
}
145151

146-
Logger.log(`${Strings.getDurationMilliseconds(start)} ms to compute gutter blame annotations`);
152+
Logger.log(cc, `${Strings.getDurationMilliseconds(start)} ms to apply all gutter blame annotations`);
153+
}
147154

148155
this.registerHoverProviders(Container.config.hovers.annotations);
149-
void this.selection(shaOrLine, blame);
150156
return true;
151157
}
152158

src/annotations/heatmapBlameAnnotationProvider.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,21 @@ import { FileAnnotationType } from '../configuration';
44
import { Container } from '../container';
55
import { GitBlameCommit } from '../git/gitService';
66
import { Logger } from '../logger';
7-
import { Strings } from '../system';
7+
import { log, Strings } from '../system';
88
import { Annotations } from './annotations';
99
import { BlameAnnotationProviderBase } from './blameAnnotationProvider';
1010

1111
export class HeatmapBlameAnnotationProvider extends BlameAnnotationProviderBase {
12+
@log()
1213
async onProvideAnnotation(shaOrLine?: string | number, type?: FileAnnotationType): Promise<boolean> {
14+
const cc = Logger.getCorrelationContext();
15+
1316
this.annotationType = FileAnnotationType.Heatmap;
1417

1518
const blame = await this.getBlame();
1619
if (blame === undefined) return false;
1720

18-
const start = process.hrtime();
21+
let start = process.hrtime();
1922

2023
const renderOptions = Annotations.heatmapRenderOptions();
2124

@@ -52,14 +55,17 @@ export class HeatmapBlameAnnotationProvider extends BlameAnnotationProviderBase
5255
decorationsMap[l.sha] = heatmap;
5356
}
5457

58+
Logger.log(cc, `${Strings.getDurationMilliseconds(start)} ms to compute heatmap annotations`);
59+
5560
if (this.decorations.length) {
61+
start = process.hrtime();
62+
5663
this.editor.setDecorations(this.decoration!, this.decorations);
57-
}
5864

59-
Logger.log(`${Strings.getDurationMilliseconds(start)} ms to compute heatmap annotations`);
65+
Logger.log(cc, `${Strings.getDurationMilliseconds(start)} ms to apply recent changes annotations`);
66+
}
6067

6168
this.registerHoverProviders(Container.config.hovers.annotations);
62-
void this.selection(shaOrLine, blame);
6369
return true;
6470
}
6571
}

src/annotations/recentChangesAnnotationProvider.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FileAnnotationType } from '../configuration';
44
import { Container } from '../container';
55
import { GitUri } from '../git/gitService';
66
import { Logger } from '../logger';
7-
import { Strings } from '../system';
7+
import { log, Strings } from '../system';
88
import { GitDocumentState, TrackedDocument } from '../trackers/gitDocumentTracker';
99
import { AnnotationProviderBase } from './annotationProvider';
1010
import { Annotations } from './annotations';
@@ -23,7 +23,10 @@ export class RecentChangesAnnotationProvider extends AnnotationProviderBase {
2323
this._uri = trackedDocument.uri;
2424
}
2525

26+
@log()
2627
async onProvideAnnotation(shaOrLine?: string | number): Promise<boolean> {
28+
const cc = Logger.getCorrelationContext();
29+
2730
this.annotationType = FileAnnotationType.RecentChanges;
2831

2932
const commit = await Container.git.getRecentLogCommitForFile(this._uri.repoPath, this._uri.fsPath);
@@ -32,7 +35,7 @@ export class RecentChangesAnnotationProvider extends AnnotationProviderBase {
3235
const diff = await Container.git.getDiffForFile(this._uri, commit.previousSha);
3336
if (diff === undefined) return false;
3437

35-
const start = process.hrtime();
38+
let start = process.hrtime();
3639

3740
const cfg = Container.config;
3841
const dateFormat = cfg.defaultDateFormat;
@@ -81,9 +84,15 @@ export class RecentChangesAnnotationProvider extends AnnotationProviderBase {
8184
}
8285
}
8386

84-
this.editor.setDecorations(this.decoration, this.decorations);
87+
Logger.log(cc, `${Strings.getDurationMilliseconds(start)} ms to compute recent changes annotations`);
88+
89+
if (this.decorations.length) {
90+
start = process.hrtime();
8591

86-
Logger.log(`${Strings.getDurationMilliseconds(start)} ms to compute recent changes annotations`);
92+
this.editor.setDecorations(this.decoration, this.decorations);
93+
94+
Logger.log(cc, `${Strings.getDurationMilliseconds(start)} ms to apply recent changes annotations`);
95+
}
8796

8897
return true;
8998
}

0 commit comments

Comments
 (0)