Skip to content

Commit 68b0716

Browse files
justschenandremmsilva
authored andcommitted
code action and lightbulb telemetry updates (microsoft#212929)
* added additional telemetry and remove unused telemetry event * removed unused imports
1 parent 13f374a commit 68b0716

File tree

2 files changed

+5
-23
lines changed

2 files changed

+5
-23
lines changed

src/vs/editor/contrib/codeAction/browser/codeActionController.ts

+3
Original file line numberDiff line numberDiff line change
@@ -317,18 +317,21 @@ export class CodeActionController extends Disposable implements IEditorContribut
317317
type ShowCodeActionListEvent = {
318318
codeActionListLength: number;
319319
didCancel: boolean;
320+
codeActions: string[];
320321
};
321322

322323
type ShowListEventClassification = {
323324
codeActionListLength: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The length of the code action list when quit out. Can be from any code action menu.' };
324325
didCancel: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'Whether the code action was cancelled or selected.' };
326+
codeActions: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'What code actions were available when cancelled.' };
325327
owner: 'justschen';
326328
comment: 'Event used to gain insights into how many valid code actions are being shown';
327329
};
328330

329331
this._telemetryService.publicLog2<ShowCodeActionListEvent, ShowListEventClassification>('codeAction.showCodeActionList.onHide', {
330332
codeActionListLength: actions.validActions.length,
331333
didCancel: didCancel,
334+
codeActions: actions.validActions.map(action => action.action.title),
332335
});
333336
}
334337
},

src/vs/editor/contrib/codeAction/browser/lightBulbWidget.ts

+2-23
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import * as dom from 'vs/base/browser/dom';
77
import { Gesture } from 'vs/base/browser/touch';
88
import { Codicon } from 'vs/base/common/codicons';
99
import { Emitter, Event } from 'vs/base/common/event';
10-
import { HierarchicalKind } from 'vs/base/common/hierarchicalKind';
1110
import { Disposable } from 'vs/base/common/lifecycle';
1211
import { ThemeIcon } from 'vs/base/common/themables';
1312
import 'vs/css!./lightBulbWidget';
@@ -16,11 +15,10 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
1615
import { IPosition } from 'vs/editor/common/core/position';
1716
import { computeIndentLevel } from 'vs/editor/common/model/utils';
1817
import { autoFixCommandId, quickFixCommandId } from 'vs/editor/contrib/codeAction/browser/codeAction';
19-
import { CodeActionKind, CodeActionSet, CodeActionTrigger } from 'vs/editor/contrib/codeAction/common/types';
18+
import { CodeActionSet, CodeActionTrigger } from 'vs/editor/contrib/codeAction/common/types';
2019
import * as nls from 'vs/nls';
2120
import { ICommandService } from 'vs/platform/commands/common/commands';
2221
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
23-
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
2422

2523
namespace LightBulbState {
2624

@@ -65,8 +63,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
6563
constructor(
6664
private readonly _editor: ICodeEditor,
6765
@IKeybindingService private readonly _keybindingService: IKeybindingService,
68-
@ICommandService commandService: ICommandService,
69-
@ITelemetryService private readonly _telemetryService: ITelemetryService,
66+
@ICommandService commandService: ICommandService
7067
) {
7168
super();
7269

@@ -200,24 +197,6 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
200197
return;
201198
}
202199

203-
const hierarchicalKind = new HierarchicalKind(actionKind);
204-
205-
if (CodeActionKind.RefactorMove.contains(hierarchicalKind)) {
206-
// Telemetry for showing code actions here. only log on `showLightbulb`. Logs when code action list is quit out.
207-
type ShowCodeActionListEvent = {
208-
codeActionListLength: number;
209-
};
210-
211-
type ShowListEventClassification = {
212-
codeActionListLength: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The length of the code action list when quit out. Can be from any code action menu.' };
213-
owner: 'justschen';
214-
comment: 'Event used to gain insights into how often the lightbulb only contains one code action, namely the move to code action. ';
215-
};
216-
217-
this._telemetryService.publicLog2<ShowCodeActionListEvent, ShowListEventClassification>('lightbulbWidget.moveToCodeActions', {
218-
codeActionListLength: validActions.length,
219-
});
220-
}
221200

222201
this._editor.layoutContentWidget(this);
223202
}

0 commit comments

Comments
 (0)