Record each completion selection for analytics (#13665)

GitOrigin-RevId: bc8e92ceca51f6365c4311204a35fc85914969b0
This commit is contained in:
Alf Eaton
2023-07-17 11:03:43 +00:00
committed by Copybot
parent 5a786029a3
commit 48e758a5fe
9 changed files with 57 additions and 15 deletions
@@ -2,7 +2,19 @@ import { EditorView } from '@codemirror/view'
import { sendMB } from '../../../../../infrastructure/event-tracking'
import { isVisual } from '../../visual/visual'
export function emitCommandEvent(view: EditorView, command: string) {
export function emitCommandEvent(
view: EditorView,
key: string,
command: string
) {
const mode = isVisual(view) ? 'visual' : 'source'
sendMB('codemirror-toolbar-event', { command, mode })
sendMB(key, { command, mode })
}
export function emitToolbarEvent(view: EditorView, command: string) {
emitCommandEvent(view, 'codemirror-toolbar-event', command)
}
export function emitCompletionEvent(view: EditorView, command: string) {
emitCommandEvent(view, 'codemirror-completion-event', command)
}