Filter more command IDs (#21910)

* Filter more command IDs

* More
This commit is contained in:
Charles Gagnon
2023-02-10 14:41:17 -08:00
committed by GitHub
parent 2b4c608b93
commit 1d96476a81

View File

@@ -11,6 +11,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ICommandService, ICommandEvent } from 'vs/platform/commands/common/commands';
import { TelemetryAction, TelemetryView } from 'sql/platform/telemetry/common/telemetryKeys';
import { Handler } from 'vs/editor/common/editorCommon';
export class SqlTelemetryContribution extends Disposable implements IWorkbenchContribution {
@@ -25,15 +26,26 @@ export class SqlTelemetryContribution extends Disposable implements IWorkbenchCo
commandService.onWillExecuteCommand(
(e: ICommandEvent) => {
// Filter out high-frequency events
if (!['type',
'deleteLeft', 'deleteRight',
'deleteWordLeft', 'deleteWordRight', 'deleteWordStartRight', 'deleteWordEndRight',
if (![
'deleteLeft', 'deleteRight', 'lineBreakInsert', 'outdent', 'redo', 'tab', 'undo', 'deleteInsideWord', // From src\vs\editor\browser\coreCommands.ts
'setContext',
'cut', 'paste', 'undo',
'tab',
'selectNextSuggestion'].some(id => id === e.commandId) &&
// Events from src\vs\editor\contrib\wordOperations\wordOperations.ts
!e.commandId.startsWith('cursor') &&
Handler.CompositionEnd, Handler.CompositionStart, Handler.CompositionType, Handler.Cut, Handler.Paste,
Handler.ReplacePreviousChar, Handler.Type,
'selectNextSuggestion', 'selectPrevSuggestion',
'acceptSelectedSuggestion', 'acceptAlternativeSelectedSuggestion', 'hideSuggestWidget',
'selectNextSuggestion', 'selectNextPageSuggestion', 'selectLastSuggestion', 'selectPrevSuggestion',
'selectPrevPageSuggestion', 'selectFirstSuggestion', 'toggleSuggestionDetails', 'toggleExplainMode', 'toggleSuggestionFocus',
'insertBestCompletion', 'insertNextSuggestion', 'insertPrevSuggestion', 'editor.action.resetSuggestSize',
'workbench.action.toggleSidebarVisibility', // From src\vs\workbench\browser\actions\layoutActions.ts
// Panel actions from src\vs\workbench\browser\parts\panel\panelActions.ts
'workbench.action.togglePanel', 'workbench.action.focusPanel', 'workbench.action.previousPanelView',
'workbench.action.nextPanelView', 'workbench.action.toggleMaximizedPanel', 'workbench.action.closePanel', 'workbench.action.closeAuxiliaryBar',
'workbench.action.movePanelToSidePanel', 'workbench.action.movePanelToSecondarySideBar', 'workbench.action.moveSidePanelToPanel', 'workbench.action.moveSecondarySideBarToPanel'
].some(id => id === e.commandId) &&
!e.commandId.startsWith('deleteWord') && // Events from src\vs\editor\contrib\wordOperations\wordOperations.ts
!e.commandId.startsWith('cursor') && // Events from src\vs\editor\contrib\wordOperations\wordOperations.ts
!e.commandId.startsWith('notification') && // Events from src\vs\workbench\browser\parts\notifications\notificationsCommands.ts
!e.commandId.startsWith('editor.action') && // All generic editor actions - not details we currently care about
!e.commandId.startsWith('_')) { // Commands starting with _ are internal commands which generally aren't useful to us currently
// Note - this event is duplicated in extHostCommands to also ensure logging of all commands contributed by extensions
telemetryService.sendActionEvent(TelemetryView.Shell, TelemetryAction.adsCommandExecuted, e.commandId);