From f629260c7e94e87dc604f71a7fa867b3ec5b96fc Mon Sep 17 00:00:00 2001 From: "y.polyakov" Date: Tue, 9 Sep 2025 22:13:16 +0300 Subject: [PATCH] support for 2025.2.0.1+ --- build.gradle.kts | 25 +++++++++++++------ gradle.properties | 10 ++++---- gradle/libs.versions.toml | 6 ++--- gradle/wrapper/gradle-wrapper.properties | 2 +- .../types/hints/HintResolver.kt | 16 ++++++------ 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 10c9944..0aadca6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML +import org.jetbrains.intellij.platform.gradle.extensions.intellijPlatform fun properties(key: String) = providers.gradleProperty(key) fun environment(key: String) = providers.environmentVariable(key) @@ -17,6 +18,17 @@ version = properties("pluginVersion").get() // Configure project's dependencies repositories { mavenCentral() + intellijPlatform { + defaultRepositories() + } +} + +dependencies { + intellijPlatform { + create(properties("platformType"), properties("platformVersion")) + // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. + bundledPlugins(properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }) + } } // Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+. @@ -28,13 +40,11 @@ kotlin { } // Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html -intellij { - pluginName = properties("pluginName") - version = properties("platformVersion") - type = properties("platformType") - - // Plugin Dependencies. Uses `platformPlugins` property from the gradle.properties file. - plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) } +intellijPlatform { + pluginConfiguration { + name = properties("pluginName") + version = properties("pluginVersion") + } } // Configure Gradle Changelog Plugin - read more: https://github.com/JetBrains/gradle-changelog-plugin @@ -49,7 +59,6 @@ tasks { } patchPluginXml { - version = properties("pluginVersion") sinceBuild = properties("pluginSinceBuild") untilBuild = properties("pluginUntilBuild") diff --git a/gradle.properties b/gradle.properties index 14f2020..761f281 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,23 +2,23 @@ pluginGroup = space.whitememory.pythoninlayparams pluginName = Python Inlay Params pluginRepositoryUrl = https://github.com/WhiteMemory99/Intellij-Python-Inlay-Params -pluginVersion = 0.3.6 +pluginVersion = 0.3.8 # See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html # for insight into build numbers and IntelliJ Platform versions. -pluginSinceBuild = 223 -pluginUntilBuild = 242.* +pluginSinceBuild = 252 +pluginUntilBuild = 299.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = PC -platformVersion = 2022.3.3 +platformVersion = 2025.2.0.1 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 platformPlugins = PythonCore # Gradle Releases -> https://github.com/gradle/gradle/releases -gradleVersion = 8.5 +gradleVersion = 8.6 # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib kotlin.stdlib.default.dependency = false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7001a3f..d6eef34 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,14 +3,14 @@ annotations = "24.1.0" # plugins -kotlin = "1.9.21" +kotlin = "2.1.21" changelog = "2.2.0" -gradleIntelliJPlugin = "1.16.1" +gradleIntelliJPlugin = "2.7.2" [libraries] annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" } [plugins] changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" } -gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" } +gradleIntelliJPlugin = { id = "org.jetbrains.intellij.platform", version.ref = "gradleIntelliJPlugin" } kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1af9e09..a80b22c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/kotlin/space/whitememory/pythoninlayparams/types/hints/HintResolver.kt b/src/main/kotlin/space/whitememory/pythoninlayparams/types/hints/HintResolver.kt index 3da5097..374bf72 100644 --- a/src/main/kotlin/space/whitememory/pythoninlayparams/types/hints/HintResolver.kt +++ b/src/main/kotlin/space/whitememory/pythoninlayparams/types/hints/HintResolver.kt @@ -5,7 +5,7 @@ import com.jetbrains.python.PyNames import com.jetbrains.python.PyTokenTypes import com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider import com.jetbrains.python.psi.* -import com.jetbrains.python.psi.impl.PyCallExpressionHelper +import com.jetbrains.python.psi.impl.PyCallExpressionNavigator import com.jetbrains.python.psi.types.* import space.whitememory.pythoninlayparams.types.variables.PythonVariablesInlayTypeHintsProvider @@ -172,7 +172,7 @@ enum class HintResolver { if ( assignedValue is PyCallExpression - && PyCallExpressionHelper.resolveCalleeClass(assignedValue) != null + && PyCallExpressionNavigator.getPyCallExpressionByCallee(assignedValue) != null ) { // Handle case like User().get_name() and list() if (typeAnnotation.isBuiltin || assignedValue.callee?.reference?.resolve() is PyFunction) { @@ -216,8 +216,8 @@ enum class HintResolver { } if (expressionOperands.leftOperand is PyCallExpression && expressionOperands.rightOperand is PyCallExpression) { - val isFalsePartClass = PyCallExpressionHelper.resolveCalleeClass(expressionOperands.leftOperand) != null - val isTruePartClass = PyCallExpressionHelper.resolveCalleeClass(expressionOperands.rightOperand) != null + val isFalsePartClass = PyCallExpressionNavigator.getPyCallExpressionByCallee(expressionOperands.leftOperand) != null + val isTruePartClass = PyCallExpressionNavigator.getPyCallExpressionByCallee(expressionOperands.rightOperand) != null if (isFalsePartClass && isTruePartClass) return false } @@ -264,9 +264,9 @@ enum class HintResolver { if (assignmentValue !is PyCallExpression) return true - if (typeAnnotation is PyNoneType) return true + if (typeAnnotation is PyNoneLiteralExpression) return true - val resolvedClass = PyCallExpressionHelper.resolveCalleeClass(assignmentValue) ?: return true + val resolvedClass = PyCallExpressionNavigator.getPyCallExpressionByCallee(assignmentValue) ?: return true if (!collectionNames.contains(resolvedClass.name)) { return resolvedClass.name != typeAnnotation?.name @@ -424,7 +424,7 @@ enum class HintResolver { if ( typeAnnotation == null - || (element is PyFunction && typeAnnotation is PyNoneType) + || (element is PyFunction && typeAnnotation is PyNoneLiteralExpression) || ((element is PyFunction || element is PyTargetExpression) && (element as PyTypeCommentOwner).typeCommentAnnotation != null) || (element is PyAnnotationOwner && element.annotation != null) ) { @@ -433,7 +433,7 @@ enum class HintResolver { if (typeAnnotation is PyUnionType) { return !typeAnnotation.members.all { - PyTypeChecker.isUnknown(it, false, typeEvalContext) || (it is PyNoneType || it == null) + PyTypeChecker.isUnknown(it, false, typeEvalContext) || (it is PyNoneLiteralExpression || it == null) } }