mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
additional lightbulb telemetry for insiders (#211407)
* added back lightbulb telemetry * some cleanup
This commit is contained in:
parent
8e65948510
commit
e0e7aeca17
|
@ -7,6 +7,7 @@ import * as dom from 'vs/base/browser/dom';
|
||||||
import { Gesture } from 'vs/base/browser/touch';
|
import { Gesture } from 'vs/base/browser/touch';
|
||||||
import { Codicon } from 'vs/base/common/codicons';
|
import { Codicon } from 'vs/base/common/codicons';
|
||||||
import { Emitter, Event } from 'vs/base/common/event';
|
import { Emitter, Event } from 'vs/base/common/event';
|
||||||
|
import { HierarchicalKind } from 'vs/base/common/hierarchicalKind';
|
||||||
import { Disposable } from 'vs/base/common/lifecycle';
|
import { Disposable } from 'vs/base/common/lifecycle';
|
||||||
import { ThemeIcon } from 'vs/base/common/themables';
|
import { ThemeIcon } from 'vs/base/common/themables';
|
||||||
import 'vs/css!./lightBulbWidget';
|
import 'vs/css!./lightBulbWidget';
|
||||||
|
@ -15,10 +16,11 @@ import { EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||||
import { IPosition } from 'vs/editor/common/core/position';
|
import { IPosition } from 'vs/editor/common/core/position';
|
||||||
import { computeIndentLevel } from 'vs/editor/common/model/utils';
|
import { computeIndentLevel } from 'vs/editor/common/model/utils';
|
||||||
import { autoFixCommandId, quickFixCommandId } from 'vs/editor/contrib/codeAction/browser/codeAction';
|
import { autoFixCommandId, quickFixCommandId } from 'vs/editor/contrib/codeAction/browser/codeAction';
|
||||||
import type { CodeActionSet, CodeActionTrigger } from 'vs/editor/contrib/codeAction/common/types';
|
import { CodeActionKind, CodeActionSet, CodeActionTrigger } from 'vs/editor/contrib/codeAction/common/types';
|
||||||
import * as nls from 'vs/nls';
|
import * as nls from 'vs/nls';
|
||||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||||
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
|
|
||||||
namespace LightBulbState {
|
namespace LightBulbState {
|
||||||
|
|
||||||
|
@ -64,6 +66,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
|
||||||
private readonly _editor: ICodeEditor,
|
private readonly _editor: ICodeEditor,
|
||||||
@IKeybindingService private readonly _keybindingService: IKeybindingService,
|
@IKeybindingService private readonly _keybindingService: IKeybindingService,
|
||||||
@ICommandService commandService: ICommandService,
|
@ICommandService commandService: ICommandService,
|
||||||
|
@ITelemetryService private readonly _telemetryService: ITelemetryService,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -189,6 +192,33 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
|
||||||
position: { lineNumber: effectiveLineNumber, column: effectiveColumnNumber },
|
position: { lineNumber: effectiveLineNumber, column: effectiveColumnNumber },
|
||||||
preference: LightBulbWidget._posPref
|
preference: LightBulbWidget._posPref
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const validActions = actions.validActions;
|
||||||
|
const actionKind = actions.validActions[0].action.kind;
|
||||||
|
if (validActions.length !== 1 || !actionKind) {
|
||||||
|
this._editor.layoutContentWidget(this);
|
||||||
|
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);
|
this._editor.layoutContentWidget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue