Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete: Track inserted completions #1380

Merged
merged 11 commits into from
Oct 17, 2023
Merged

Autocomplete: Track inserted completions #1380

merged 11 commits into from
Oct 17, 2023

Conversation

philipp-spiess
Copy link
Contributor

@philipp-spiess philipp-spiess commented Oct 12, 2023

Adds tracking for inserted completion after 30 seconds, 2 minutes, 5 minutes, 10 minutes.

This also replaces our levenshtein comparator since I found a bug in the current implementation (see the added test case for more context).

Test plan

█ logEvent (telemetry disabled): CodyVSCodeExtension:completion:persistence:present {"id":"eeae5ebe-11d2-4263-ad4e-e5a9ae2f25c4","afterSec":30,"isMostlyUnchanged":true,"difference":0.2571428571428571,"lineCount":1,"charCount":26}
█ logEvent (telemetry disabled): CodyVSCodeExtension:completion:persistence:present {"id":"eeae5ebe-11d2-4263-ad4e-e5a9ae2f25c4","afterSec":120,"isMostlyUnchanged":true,"difference":0.2571428571428571,"lineCount":1,"charCount":26}
█ logEvent (telemetry disabled): CodyVSCodeExtension:completion:persistence:present {"id":"eeae5ebe-11d2-4263-ad4e-e5a9ae2f25c4","afterSec":300,"isMostlyUnchanged":true,"difference":0.2571428571428571,"lineCount":1,"charCount":26}
█ logEvent (telemetry disabled): CodyVSCodeExtension:completion:persistence:present {"id":"eeae5ebe-11d2-4263-ad4e-e5a9ae2f25c4","afterSec":600,"isMostlyUnchanged":false,"difference":0.6285714285714286,"lineCount":1,"charCount":20}

@philipp-spiess philipp-spiess marked this pull request as ready for review October 16, 2023 10:41
Copy link
Contributor

@arafatkatze arafatkatze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New data incoming! 🎉

vscode/src/completions/logger.ts Show resolved Hide resolved
vscode/src/completions/logger.ts Outdated Show resolved Hide resolved
vscode/src/completions/persistence-tracker.test.ts Outdated Show resolved Hide resolved
Comment on lines +19 to +20
// When a document is rename, the TextDocument instance will still work
// however the URI it resolves to will be outdated. Ensure we never use it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦸‍♂️

logCompletionEvent('persistence:present', {
id: trackedCompletion.id,
afterSec: MEASURE_TIMEOUTS[measureTimeoutsIndex] / 1000,
isMostlyUnchanged,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to log this flag? Might as well use the difference field we already have and define the isMostlyUnchanged value in the analytics dashboard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const initialText = trackedCompletion.completion.insertText
const latestText = trackedCompletion.document.getText(trackedCompletion.latestRange)

if (latestText.length === 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's possible, but we might want to filter out items where initialText.length === 0 too

Comment on lines 48 to 49
return levenshtein(A, B)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove this helper (LevenshteinCompare) altogether because it doesn't add value?

@philipp-spiess philipp-spiess enabled auto-merge (squash) October 17, 2023 13:26
@philipp-spiess philipp-spiess merged commit 3280a02 into main Oct 17, 2023
15 checks passed
@philipp-spiess philipp-spiess deleted the ps/ac-tracking branch October 17, 2023 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants