@@ -14,6 +14,7 @@ import { InstantiationType, registerSingleton } from '../../../platform/instanti
14
14
import { createDecorator , ServicesAccessor } from '../../../platform/instantiation/common/instantiation.js' ;
15
15
import { IQuickInputService , IQuickPickItem } from '../../../platform/quickinput/common/quickInput.js' ;
16
16
import { IStorageService , StorageScope , StorageTarget } from '../../../platform/storage/common/storage.js' ;
17
+ import { ITelemetryService } from '../../../platform/telemetry/common/telemetry.js' ;
17
18
18
19
export const IInlineCompletionsService = createDecorator < IInlineCompletionsService > ( 'IInlineCompletionsService' ) ;
19
20
@@ -69,7 +70,10 @@ export class InlineCompletionsService extends Disposable implements IInlineCompl
69
70
70
71
private _timer : WindowIntervalTimer ;
71
72
72
- constructor ( @IContextKeyService private _contextKeyService : IContextKeyService ) {
73
+ constructor (
74
+ @IContextKeyService private _contextKeyService : IContextKeyService ,
75
+ @ITelemetryService private _telemetryService : ITelemetryService ,
76
+ ) {
73
77
super ( ) ;
74
78
75
79
this . _timer = this . _register ( new WindowIntervalTimer ( ) ) ;
@@ -92,6 +96,8 @@ export class InlineCompletionsService extends Disposable implements IInlineCompl
92
96
}
93
97
94
98
const wasSnoozing = this . isSnoozing ( ) ;
99
+ const timeLeft = this . snoozeTimeLeft ;
100
+
95
101
this . _snoozeTimeEnd = Date . now ( ) + durationMs ;
96
102
97
103
if ( ! wasSnoozing ) {
@@ -108,6 +114,8 @@ export class InlineCompletionsService extends Disposable implements IInlineCompl
108
114
} ,
109
115
this . snoozeTimeLeft + 1 ,
110
116
) ;
117
+
118
+ this . _reportSnooze ( durationMs - timeLeft , durationMs ) ;
111
119
}
112
120
113
121
isSnoozing ( ) : boolean {
@@ -116,11 +124,28 @@ export class InlineCompletionsService extends Disposable implements IInlineCompl
116
124
117
125
cancelSnooze ( ) : void {
118
126
if ( this . isSnoozing ( ) ) {
127
+ this . _reportSnooze ( - this . snoozeTimeLeft , 0 ) ;
119
128
this . _snoozeTimeEnd = undefined ;
120
129
this . _timer . cancel ( ) ;
121
130
this . _onDidChangeIsSnoozing . fire ( false ) ;
122
131
}
123
132
}
133
+
134
+ private _reportSnooze ( deltaMs : number , totalMs : number ) : void {
135
+ const deltaSeconds = Math . round ( deltaMs / 1000 ) ;
136
+ const totalSeconds = Math . round ( totalMs / 1000 ) ;
137
+ type WorkspaceStatsClassification = {
138
+ owner : 'benibenj' ;
139
+ comment : 'Snooze duration for inline completions' ;
140
+ deltaSeconds : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'The duration by which the snooze has changed, in seconds.' } ;
141
+ totalSeconds : { classification : 'SystemMetaData' ; purpose : 'FeatureInsight' ; comment : 'The total duration for which inline completions are snoozed, in seconds.' } ;
142
+ } ;
143
+ type WorkspaceStatsEvent = {
144
+ deltaSeconds : number ;
145
+ totalSeconds : number ;
146
+ } ;
147
+ this . _telemetryService . publicLog2 < WorkspaceStatsEvent , WorkspaceStatsClassification > ( 'inlineCompletions.snooze' , { deltaSeconds, totalSeconds } ) ;
148
+ }
124
149
}
125
150
126
151
registerSingleton ( IInlineCompletionsService , InlineCompletionsService , InstantiationType . Delayed ) ;
0 commit comments