mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-83776: Add logging to trace the problem.
Enable the following log: ``` #com.intellij.python.community.services.shared:debug ``` GitOrigin-RevId: 7ea444ebca62d3f8186d983cd10381199165a0a2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
413db55906
commit
682550148c
@@ -18,6 +18,8 @@ jvm_library(
|
||||
"@lib//:jetbrains-annotations",
|
||||
"//platform/eel-provider",
|
||||
"//python/python-exec-service/execService.python",
|
||||
"//platform/diagnostic",
|
||||
"//platform/util",
|
||||
],
|
||||
runtime_deps = [":shared_resources"]
|
||||
)
|
||||
@@ -40,6 +42,8 @@ jvm_library(
|
||||
"@lib//:hamcrest",
|
||||
"//python/python-exec-service/execService.python",
|
||||
"//python/python-exec-service/execService.python:execService.python_test_lib",
|
||||
"//platform/diagnostic",
|
||||
"//platform/util",
|
||||
],
|
||||
runtime_deps = [":shared_resources"]
|
||||
)
|
||||
|
||||
@@ -18,5 +18,7 @@
|
||||
<orderEntry type="module" module-name="intellij.platform.testFramework.junit5" scope="TEST" />
|
||||
<orderEntry type="library" scope="TEST" name="hamcrest" level="project" />
|
||||
<orderEntry type="module" module-name="intellij.python.community.execService.python" />
|
||||
<orderEntry type="module" module-name="intellij.platform.diagnostic" />
|
||||
<orderEntry type="module" module-name="intellij.platform.util" />
|
||||
</component>
|
||||
</module>
|
||||
+25
-7
@@ -1,21 +1,39 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.python.community.services.shared
|
||||
|
||||
import com.intellij.openapi.diagnostic.fileLogger
|
||||
import com.jetbrains.python.psi.LanguageLevel
|
||||
import java.util.*
|
||||
|
||||
|
||||
private val logger = fileLogger()
|
||||
|
||||
object LanguageLevelComparator : Comparator<LanguageLevelHolder> {
|
||||
override fun compare(o1: LanguageLevelHolder, o2: LanguageLevelHolder): Int =
|
||||
override fun compare(o1: LanguageLevelHolder, o2: LanguageLevelHolder): Int {
|
||||
// Backward: first python is the highest
|
||||
o1.languageLevel.compareTo(o2.languageLevel) * -1
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("langLevel ${o1.languageLevel} vs ${o2.languageLevel}")
|
||||
}
|
||||
return LanguageLevel.VERSION_COMPARATOR.compare(o1.languageLevel, o2.languageLevel) * -1
|
||||
}
|
||||
}
|
||||
|
||||
object UiComparator : Comparator<UiHolder> {
|
||||
override fun compare(o1: UiHolder, o2: UiHolder): Int =
|
||||
Objects.compare(o1.ui, o2.ui, Comparator.nullsFirst(UICustomization::compareTo))
|
||||
override fun compare(o1: UiHolder, o2: UiHolder): Int {
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("ui ${o1.ui?.title} vs ${o2.ui?.title}")
|
||||
}
|
||||
return Objects.compare(o1.ui, o2.ui, Comparator.nullsFirst(UICustomization::compareTo))
|
||||
}
|
||||
}
|
||||
|
||||
class LanguageLevelWithUiComparator<T> : Comparator<T> where T : LanguageLevelHolder, T : UiHolder {
|
||||
override fun compare(o1: T, o2: T): Int =
|
||||
LanguageLevelComparator.compare(o1, o2) * 10 + UiComparator.compare(o1, o2)
|
||||
}
|
||||
override fun compare(o1: T, o2: T): Int {
|
||||
if (logger.isDebugEnabled) {
|
||||
logger.debug("full ${o1.string()} vs ${o2.string()}")
|
||||
}
|
||||
return LanguageLevelComparator.compare(o1, o2) * 10 + UiComparator.compare(o1, o2)
|
||||
}
|
||||
}
|
||||
|
||||
private fun <T> T.string(): String where T : LanguageLevelHolder, T : UiHolder = "($languageLevel,${ui?.title})"
|
||||
|
||||
Reference in New Issue
Block a user