Skip to content

Commit

Permalink
VS Code: improve characters logger (#5855)
Browse files Browse the repository at this point in the history
This update fixes data discrepancies in calculating the percentage of
code written by Cody events by increasing the accuracy of the
`CharactersLogger`. Previously, the logger was counting character
changes not directly typed by the user. Now, document changes are
grouped by sources, providing flexibility in handling this data as
needed.

The new `cody.characters` telemetry event structure:

```json
{
  "normal_inserted": 0,
  "normal_deleted": 0,
  "undo_inserted": 0,
  "undo_deleted": 0,
  "redo_inserted": 0,
  "redo_deleted": 0,
  "windowNotFocused_inserted": 0,
  "windowNotFocused_deleted": 0,
  "nonVisibleDocument_inserted": 3,
  "nonVisibleDocument_deleted": 0,
  "inactiveSelection_inserted": 0,
  "inactiveSelection_deleted": 0,
  "rapidLargeChange_inserted": 0,
  "rapidLargeChange_deleted": 0
}
```
  • Loading branch information
valerybugakov authored Oct 14, 2024
1 parent 3a8462b commit f9038ef
Show file tree
Hide file tree
Showing 3 changed files with 410 additions and 72 deletions.
2 changes: 1 addition & 1 deletion agent/src/AgentWorkspaceDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class AgentWorkspaceDocuments implements vscode_shim.WorkspaceDocuments {
}

// We have seen this document before, which means we mutate the existing
// document to reflect the latest chagnes. For each URI, we keep a
// document to reflect the latest changes. For each URI, we keep a
// singleton document so that `AgentTextDocument.getText()` always
// reflects the latest value.
const contentChanges: vscode.TextDocumentContentChangeEvent[] = []
Expand Down
Loading

0 comments on commit f9038ef

Please sign in to comment.