提交 4ee5bfc4 编写于 作者: I isidor

untitle hint: add telemetry from

上级 13caeee4
......@@ -10,7 +10,7 @@ import { format, compare, splitLines } from 'vs/base/common/strings';
import { extname, basename, isEqual } from 'vs/base/common/resources';
import { areFunctions, withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { Action } from 'vs/base/common/actions';
import { Action, WorkbenchActionExecutedClassification, WorkbenchActionExecutedEvent } from 'vs/base/common/actions';
import { Language } from 'vs/base/common/platform';
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { IFileEditorInput, EncodingMode, IEncodingSupport, EditorResourceAccessor, SideBySideEditorInput, IEditorPane, IEditorInput, SideBySideEditor, IModeSupport } from 'vs/workbench/common/editor';
......@@ -52,6 +52,7 @@ import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment, IStatus
import { IMarker, IMarkerService, MarkerSeverity, IMarkerData } from 'vs/platform/markers/common/markers';
import { STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGROUND } from 'vs/workbench/common/theme';
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
class SideBySideEditorEncodingSupport implements IEncodingSupport {
constructor(private primary: IEncodingSupport, private secondary: IEncodingSupport) { }
......@@ -1063,12 +1064,13 @@ export class ChangeModeAction extends Action {
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ITextFileService private readonly textFileService: ITextFileService,
@ICommandService private readonly commandService: ICommandService
@ICommandService private readonly commandService: ICommandService,
@ITelemetryService private readonly telemetryService: ITelemetryService
) {
super(actionId, actionLabel);
}
async run(): Promise<void> {
async run(event: any, data: ITelemetryData): Promise<void> {
const activeEditorPane = this.editorService.activeEditorPane as unknown as { isNotebookEditor?: boolean } | undefined;
if (activeEditorPane?.isNotebookEditor) { // TODO@rebornix TODO@jrieken debt: https://github.com/microsoft/vscode/issues/114554
// it's inside notebook editor
......@@ -1198,6 +1200,10 @@ export class ChangeModeAction extends Action {
}
activeTextEditorControl.focus();
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', {
id: ChangeModeAction.ID,
from: data?.from || 'quick open'
});
}
}
......
......@@ -60,7 +60,7 @@ export class UntitledHintContribution implements IEditorContribution {
if (untitledHintMode === 'button') {
this.button = new FloatingClickWidget(this.editor, localize('selectALanguage', "Select a Language"), ChangeModeAction.ID, this.keybindingService, this.themeService);
this.toDispose.push(this.button.onClick(async () => {
await this.commandService.executeCommand(ChangeModeAction.ID);
await this.commandService.executeCommand(ChangeModeAction.ID, { from: 'button' });
this.editor.focus();
}));
this.button.render();
......@@ -132,7 +132,7 @@ class UntitledHintContentWidget implements IContentWidget {
this.toDispose.push(dom.addDisposableListener(language, 'click', async e => {
e.stopPropagation();
await this.commandService.executeCommand(ChangeModeAction.ID);
await this.commandService.executeCommand(ChangeModeAction.ID, { from: 'hint' });
this.editor.focus();
}));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册