mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 11:53:49 +07:00
[ai-completion] Add descriptions to typing speed logs
GitOrigin-RevId: 4846e96207f600999495eadad4ca2151077cef40
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4972249373
commit
a19f5c1d35
@@ -284,7 +284,7 @@ internal object InlineCompletionContextLogs {
|
||||
val SCOPE_VALUABLE_SYMBOLS_AFTER = scopeFeatures { EventFields.Boolean("${it}_scope_valuable_symbols_after", "False if in the ${it} scope after caret there are only whitespaces or statements/strings enclosures") }
|
||||
val SCOPE_HAS_ERROR_PSI = scopeFeatures { EventFields.Boolean("${it}_scope_has_error_psi", "True if in the ${it} scope there's any PsiError element") }
|
||||
|
||||
val TIME_SINCE_LAST_TYPING = register(EventFields.Long("time_since_last_typing"))
|
||||
val TIME_SINCE_LAST_TYPING = register(EventFields.Long("time_since_last_typing", "Duration between current typing and previous one."))
|
||||
val TYPING_SPEEDS = TypingSpeedTracker.getEventFields().map {
|
||||
register(it)
|
||||
}
|
||||
|
||||
@@ -82,7 +82,20 @@ class TypingSpeedTracker {
|
||||
|
||||
companion object {
|
||||
private val DECAY_DURATIONS = listOf(1, 2, 5, 30)
|
||||
.associate { it.seconds to Pair(EventFields.Float("typing_speed_${it}s"), OldFeatureDeclaration.float("typing_speed_${it}s").nullable()) }
|
||||
.associate {
|
||||
it.seconds to Pair(
|
||||
EventFields.Float("typing_speed_${it}s", """
|
||||
Typing speed with exponential smoothing factor derived from decay_duration $it seconds as
|
||||
`alpha = 0.5.pow(time_since_last_typing / decay_duration)`.
|
||||
Last speed (typings per minute) is computed as:
|
||||
`V_last = 60 / time_since_last_typing`
|
||||
And resulting formula:
|
||||
`V_avg = alpha * V_avg_previous + (1 - alpha) * V_last`
|
||||
Note: it's an alternative for moving average for time series. The lesser decay_duration the bigger weight recent typing speed gets in the averaging.
|
||||
""".trimIndent()
|
||||
),
|
||||
OldFeatureDeclaration.float("typing_speed_${it}s").nullable())
|
||||
}
|
||||
private val DECAY_DURATIONS_NEW = listOf(1, 2, 5, 30)
|
||||
.associate { it.seconds to Pair(EventFields.Float("typing_speed_${it}s"), NewFeatureDeclaration.float("typing_speed_${it}s").nullable()) }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user