Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 5365f91

Browse files
authored
better logging for trigger-more-eagerly autocomplete (#273)
Instruments our existing autocomplete logging to better track the new trigger-more-eagerly behavior introduced in #260: 1. Whether user has the `cody.autocomplete.experimental.triggerMoreEagerly` setting enabled. 1. Whether the completion was shown only because of that setting. ## Test plan n/a; for experimental feature only
1 parent 2b2cf86 commit 5365f91

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@
930930
"cody.autocomplete.experimental.triggerMoreEagerly": {
931931
"type": "boolean",
932932
"default": false,
933-
"markdownDescription": "Trigger autocomplete when the cursor is at the end of a word (instead of waiting for a space or other non-word character)."
933+
"markdownDescription": "Trigger autocomplete when the cursor is at the end of a word (instead of waiting for a space or other non-word character). Share feedback at https://github.com/sourcegraph/cody/discussions/274."
934934
},
935935
"cody.plugins.enabled": {
936936
"type": "boolean",

vscode/src/completions/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ export class CodyCompletionItemProvider implements vscode.InlineCompletionItemPr
187187
if (cursorAtWord && !this.triggerMoreEagerly) {
188188
return []
189189
}
190+
const triggeredMoreEagerly = this.triggerMoreEagerly && cursorAtWord
190191

191192
// Don't show completions if a selected completion info is present (so something is selected
192193
// from the completions dropdown list based on the lang server) and the returned completion
@@ -287,6 +288,10 @@ export class CodyCompletionItemProvider implements vscode.InlineCompletionItemPr
287288
providerIdentifier: this.providerConfig.identifier,
288289
languageId,
289290
contextSummary,
291+
triggeredMoreEagerly,
292+
settings: {
293+
'cody.autocomplete.experimental.triggerMoreEagerly': this.triggerMoreEagerly,
294+
},
290295
})
291296
const stopLoading = this.statusBar.startLoading('Completions are being generated')
292297
this.stopLoading = stopLoading

vscode/src/completions/logger.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ interface CompletionEvent {
1414
duration: number
1515
}
1616
languageId: string
17+
18+
/**
19+
* Whether the completion was triggered only because of the experimental settting
20+
* `cody.autocomplete.experimental.triggerMoreEagerly`.
21+
*/
22+
triggeredMoreEagerly: boolean
23+
24+
/** Relevant user settings. */
25+
settings: {
26+
'cody.autocomplete.experimental.triggerMoreEagerly': boolean
27+
}
1728
}
1829
// The timestamp when the request started
1930
startedAt: number
@@ -57,7 +68,7 @@ export function start(params: CompletionEvent['params']): string {
5768
return id
5869
}
5970

60-
// Suggested completions will not logged individually. Instead, we log them when
71+
// Suggested completions will not be logged individually. Instead, we log them when
6172
// we either hide them again (they are NOT accepted) or when they ARE accepted.
6273
// This way, we can calculate the duration they were actually visible.
6374
export function suggest(id: string): void {

0 commit comments

Comments
 (0)