Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code action and lightbulb telemetry updates #212929

Merged
merged 2 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -317,18 +317,21 @@ export class CodeActionController extends Disposable implements IEditorContribut
type ShowCodeActionListEvent = {
codeActionListLength: number;
didCancel: boolean;
codeActions: string[];
};

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

this._telemetryService.publicLog2<ShowCodeActionListEvent, ShowListEventClassification>('codeAction.showCodeActionList.onHide', {
codeActionListLength: actions.validActions.length,
didCancel: didCancel,
codeActions: actions.validActions.map(action => action.action.title),
});
}
},
Expand Down
25 changes: 2 additions & 23 deletions src/vs/editor/contrib/codeAction/browser/lightBulbWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as dom from 'vs/base/browser/dom';
import { Gesture } from 'vs/base/browser/touch';
import { Codicon } from 'vs/base/common/codicons';
import { Emitter, Event } from 'vs/base/common/event';
import { HierarchicalKind } from 'vs/base/common/hierarchicalKind';
import { Disposable } from 'vs/base/common/lifecycle';
import { ThemeIcon } from 'vs/base/common/themables';
import 'vs/css!./lightBulbWidget';
Expand All @@ -16,11 +15,10 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { IPosition } from 'vs/editor/common/core/position';
import { computeIndentLevel } from 'vs/editor/common/model/utils';
import { autoFixCommandId, quickFixCommandId } from 'vs/editor/contrib/codeAction/browser/codeAction';
import { CodeActionKind, CodeActionSet, CodeActionTrigger } from 'vs/editor/contrib/codeAction/common/types';
import { CodeActionSet, CodeActionTrigger } from 'vs/editor/contrib/codeAction/common/types';
import * as nls from 'vs/nls';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';

namespace LightBulbState {

Expand Down Expand Up @@ -65,8 +63,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
constructor(
private readonly _editor: ICodeEditor,
@IKeybindingService private readonly _keybindingService: IKeybindingService,
@ICommandService commandService: ICommandService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@ICommandService commandService: ICommandService
) {
super();

Expand Down Expand Up @@ -200,24 +197,6 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
return;
}

const hierarchicalKind = new HierarchicalKind(actionKind);

if (CodeActionKind.RefactorMove.contains(hierarchicalKind)) {
// Telemetry for showing code actions here. only log on `showLightbulb`. Logs when code action list is quit out.
type ShowCodeActionListEvent = {
codeActionListLength: number;
};

type ShowListEventClassification = {
codeActionListLength: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The length of the code action list when quit out. Can be from any code action menu.' };
owner: 'justschen';
comment: 'Event used to gain insights into how often the lightbulb only contains one code action, namely the move to code action. ';
};

this._telemetryService.publicLog2<ShowCodeActionListEvent, ShowListEventClassification>('lightbulbWidget.moveToCodeActions', {
codeActionListLength: validActions.length,
});
}

this._editor.layoutContentWidget(this);
}
Expand Down
Loading