mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-39742 Fix checking show diff enabled
GitOrigin-RevId: cf62cfb4eef59b291be75955b4252617cee9e3e5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
024cdece96
commit
ca23bb270d
+1
-1
@@ -34,7 +34,7 @@ public class CompletionMLRankingSettings implements PersistentStateComponent<Com
|
||||
}
|
||||
|
||||
public boolean isShowDiffEnabled() {
|
||||
return myState.showDiff;
|
||||
return myState.showDiff || Registry.is("completion.stats.show.ml.ranking.diff", false);
|
||||
}
|
||||
|
||||
void setRankingEnabled(boolean value) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.codeInsight.completion.CompletionParameters
|
||||
import com.intellij.codeInsight.lookup.LookupElement
|
||||
import com.intellij.codeInsight.lookup.LookupManager
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
||||
import com.intellij.completion.settings.CompletionMLRankingSettings
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.util.Pair
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
@@ -180,7 +181,7 @@ class MLSorter : CompletionFinalSorter() {
|
||||
}
|
||||
|
||||
private fun Iterable<LookupElement>.addDiagnosticsIfNeeded(positionsBefore: Map<LookupElement, Int>, reordered: Int): Iterable<LookupElement> {
|
||||
if (Registry.`is`("completion.stats.show.ml.ranking.diff")) {
|
||||
if (CompletionMLRankingSettings.getInstance().isShowDiffEnabled) {
|
||||
this.forEachIndexed { position, element ->
|
||||
val before = positionsBefore.getValue(element)
|
||||
if (before < reordered || position < reordered) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.intellij.stats.completion
|
||||
|
||||
|
||||
import com.intellij.codeInsight.lookup.impl.LookupImpl
|
||||
import com.intellij.completion.settings.CompletionMLRankingSettings
|
||||
import com.intellij.ide.plugins.PluginManagerCore
|
||||
import com.intellij.ide.ui.UISettings
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
@@ -49,7 +50,7 @@ class CompletionFileLogger(private val installationUID: String,
|
||||
event.isAutoPopup = CompletionUtil.getCurrentCompletionParameters()?.isAutoPopup
|
||||
event.fillCompletionParameters()
|
||||
event.additionalDetails["alphabetical"] = UISettings.instance.sortLookupElementsLexicographically.toString()
|
||||
if (Registry.`is`("completion.stats.show.ml.ranking.diff", false)) {
|
||||
if (CompletionMLRankingSettings.getInstance().isShowDiffEnabled) {
|
||||
event.additionalDetails["diff"] = "1"
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ class ItemsDiffCustomizingContributor : CompletionContributor() {
|
||||
|
||||
private fun shouldShowDiff(parameters: CompletionParameters): Boolean {
|
||||
val mlRankingSettings = CompletionMLRankingSettings.getInstance()
|
||||
if (!mlRankingSettings.isShowDiffEnabled && !Registry.`is`("completion.stats.show.ml.ranking.diff")) return false
|
||||
if (!mlRankingSettings.isShowDiffEnabled) return false
|
||||
if (!mlRankingSettings.isRankingEnabled) return false
|
||||
val lookup = LookupManager.getActiveLookup(parameters.editor) as? LookupImpl ?: return false
|
||||
return LookupStorage.get(lookup)?.model != null
|
||||
|
||||
Reference in New Issue
Block a user