@@ -39,7 +39,7 @@ export class WakaTime {
39
39
private AIDebounceTimeoutId : any = null ;
40
40
private AIdebounceMs = 1000 ;
41
41
private AIdebounceCount = 0 ;
42
- private AIpasteLastTime : number = 0 ;
42
+ private AIrecentPastes : number [ ] = [ ] ;
43
43
private dependencies : Dependencies ;
44
44
private options : Options ;
45
45
private logger : Logger ;
@@ -483,7 +483,7 @@ export class WakaTime {
483
483
this . isAICodeGenerating = true ;
484
484
this . AIdebounceCount = 0 ;
485
485
}
486
- this . AIpasteLastTime = now ;
486
+ this . AIrecentPastes . push ( now ) ;
487
487
} else if (
488
488
this . isAICodeGenerating &&
489
489
e . contentChanges . length === 1 &&
@@ -497,7 +497,7 @@ export class WakaTime {
497
497
this . AIDebounceTimeoutId = setTimeout ( ( ) => {
498
498
if ( this . AIdebounceCount > 1 ) {
499
499
this . isAICodeGenerating = false ;
500
- this . AIpasteLastTime = 0 ;
500
+ this . AIrecentPastes = [ ] ;
501
501
}
502
502
} , this . AIdebounceMs ) ;
503
503
} else if ( this . isAICodeGenerating ) {
@@ -969,7 +969,8 @@ export class WakaTime {
969
969
}
970
970
971
971
private recentlyAIPasted ( time : number ) : boolean {
972
- return this . AIpasteLastTime + 100 >= time ;
972
+ this . AIrecentPastes = this . AIrecentPastes . filter ( ( x ) => x + 500 >= time ) ;
973
+ return this . AIrecentPastes . length > 3 ;
973
974
}
974
975
975
976
private isDuplicateHeartbeat ( file : string , time : number , selection : vscode . Position ) : boolean {
0 commit comments