[change-reminder] add a registry key for the limit on the analyzed changes number

GitOrigin-RevId: 273b2c61501f89922dea2ff91487e96e5ee366fb
This commit is contained in:
Julia Beliaeva
2019-09-02 20:01:51 +00:00
committed by intellij-monorepo-bot
parent d386267487
commit d397d17af8
2 changed files with 6 additions and 1 deletions
@@ -30,6 +30,10 @@
<registryKey key="vcs.changeReminder.prediction.threshold"
defaultValue="0.8"
description="Do not show files which have probability less than threshold in Related Files node in Local Changes."/>
<registryKey key="vcs.changeReminder.changes.limit"
defaultValue="25"
description="A maximum number of changes for which predictions are calculated"/>
<applicationService serviceImplementation="com.jetbrains.changeReminder.plugin.UserSettings"/>
<statistics.counterUsagesCollector groupId="vcs.change.reminder" version="1"/>
<vcs.changes.changesViewModifier implementation="com.jetbrains.changeReminder.changes.ChangeReminderChangesViewModifier"/>
@@ -5,6 +5,7 @@ import com.intellij.openapi.Disposable
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.vcs.FilePath
import com.intellij.openapi.vcs.changes.ChangeListAdapter
import com.intellij.openapi.vcs.changes.ChangeListManager
@@ -120,7 +121,7 @@ class PredictionService(val project: Project,
private fun calculatePrediction() = synchronized(LOCK) {
setPrediction(emptyList())
val changes = changeListManager.defaultChangeList.changes
if (changes.size > 25) return
if (changes.size > Registry.intValue("vcs.changeReminder.changes.limit")) return
val (dataManager, filesHistoryProvider) = predictionRequirements ?: return
if (dataManager.dataPack.isFull) {
taskController.request(PredictionRequest(project, dataManager, filesHistoryProvider, changes))