@@ -4,7 +4,7 @@ import { FileAnnotationType } from '../configuration';
44import { Container } from '../container' ;
55import { GitUri } from '../git/gitService' ;
66import { Logger } from '../logger' ;
7- import { Strings } from '../system' ;
7+ import { log , Strings } from '../system' ;
88import { GitDocumentState , TrackedDocument } from '../trackers/gitDocumentTracker' ;
99import { AnnotationProviderBase } from './annotationProvider' ;
1010import { 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