|
5 | 5 |
|
6 | 6 | import { reverseOrder, compareBy, numberComparator, sumBy } from '../../../../base/common/arrays.js';
|
7 | 7 | import { IntervalTimer, TimeoutTimer } from '../../../../base/common/async.js';
|
| 8 | +import { onUnexpectedError } from '../../../../base/common/errors.js'; |
8 | 9 | import { toDisposable, DisposableStore, Disposable } from '../../../../base/common/lifecycle.js';
|
9 | 10 | import { mapObservableArrayCached, derived, IReader, IObservable, observableSignal, runOnChange, IObservableWithChange, observableValue, transaction, derivedObservableWithCache } from '../../../../base/common/observable.js';
|
10 | 11 | import { isDefined } from '../../../../base/common/types.js';
|
@@ -353,18 +354,21 @@ class ArcTelemetrySender extends Disposable {
|
353 | 354 |
|
354 | 355 | this._register(runOnChange(docWithAnnotatedEdits.value, (_val, _prev, changes) => {
|
355 | 356 | const edit = AnnotatedStringEdit.compose(changes.map(c => c.edit));
|
356 |
| - if (edit.replacements.length !== 1) { |
| 357 | + |
| 358 | + if (!edit.replacements.some(r => r.data.editReason.metadata.source === 'inlineCompletionAccept')) { |
| 359 | + return; |
| 360 | + } |
| 361 | + if (!edit.replacements.every(r => r.data.editReason.metadata.source === 'inlineCompletionAccept')) { |
| 362 | + onUnexpectedError(new Error('ArcTelemetrySender: Not all edits are inline completion accept edits!')); |
357 | 363 | return;
|
358 | 364 | }
|
359 |
| - const singleEdit = edit.replacements[0]; |
360 |
| - const data = singleEdit.data.editReason.metadata; |
361 |
| - if (data?.source !== 'inlineCompletionAccept') { |
| 365 | + if (edit.replacements[0].data.editReason.metadata.source !== 'inlineCompletionAccept') { |
362 | 366 | return;
|
363 | 367 | }
|
| 368 | + const data = edit.replacements[0].data.editReason.metadata; |
364 | 369 |
|
365 | 370 | const docWithJustReason = createDocWithJustReason(docWithAnnotatedEdits, this._store);
|
366 |
| - const reporter = this._instantiationService.createInstance(ArcTelemetryReporter, docWithJustReason, scmRepoBridge, singleEdit.toEdit(), res => { |
367 |
| - |
| 371 | + const reporter = this._instantiationService.createInstance(ArcTelemetryReporter, docWithJustReason, scmRepoBridge, edit, res => { |
368 | 372 | res.telemetryService.publicLog2<{
|
369 | 373 | extensionId: string;
|
370 | 374 | extensionVersion: string;
|
@@ -437,6 +441,7 @@ export class ArcTelemetryReporter {
|
437 | 441 | this._initialBranchName = this._gitRepo?.headBranchNameObs.get();
|
438 | 442 |
|
439 | 443 | // This aligns with github inline completions
|
| 444 | + this._report(0); // for debugging |
440 | 445 | this._reportAfter(30 * 1000);
|
441 | 446 | this._reportAfter(120 * 1000);
|
442 | 447 | this._reportAfter(300 * 1000);
|
|
0 commit comments