Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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+.
Expand All @@ -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
Expand All @@ -49,7 +59,6 @@ tasks {
}

patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
) {
Expand All @@ -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)
}
}

Expand Down
Loading