Merge pull request #2794 from glm1024/2335-autocomplete-jsonl

1.Add a timestamp attribute to the file autocomplete.jsonl. 2.Fix the…
This commit is contained in:
Nate Sesti 2024-11-03 00:59:28 -07:00 • committed by GitHub
commit 56b19b4344
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -89,6 +89,7 @@ export interface AutocompleteOutcome extends TabAutocompleteOptions {
gitRepo?: string;
completionId: string;
uniqueId: string;
timestamp: number;
}
const autocompleteCache = AutocompleteLruCache.get();
@ -372,6 +373,12 @@ export class CompletionProvider {
}
}, 100);
// When using the JetBrains extension, Mark as displayed
const ideType = (await this.ide.getIdeInfo()).ideType;
if (ideType === "jetbrains") {
this.markDisplayed(input.completionId, outcome);
}
return outcome;
} catch (e: any) {
this.onError(e);
@ -763,6 +770,7 @@ export class CompletionProvider {
}
const time = Date.now() - startTime;
const timestamp = Date.now();
return {
time,
completion,
@ -777,6 +785,7 @@ export class CompletionProvider {
completionId: input.completionId,
gitRepo: await this.ide.getRepoName(input.filepath),
uniqueId: await this.ide.getUniqueId(),
timestamp: timestamp,
...options,
};
}

View file

@ -192,10 +192,9 @@ class AutocompleteService(private val project: Project) {
editor.caretModel.moveToOffset(offset + text.length)
project.service<ContinuePluginService>().coreMessenger?.request(
"autocomplete/accept",
completion.completionId,
hashMapOf("completionId" to completion.completionId),
null,
({})
)