From 1654101ca19b54b7d2d2fbe9803506ffafdd8c59 Mon Sep 17 00:00:00 2001 From: Divaltor Date: Sat, 24 Sep 2022 17:09:48 +0300 Subject: [PATCH] Fix expressions like "-1" or "+1.0" --- .../pythoninlayparams/types/hints/HintResolver.kt | 6 ++++++ 1 file changed, 6 insertions(+) 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 b10c6a6..2be63c9 100644 --- a/src/main/kotlin/space/whitememory/pythoninlayparams/types/hints/HintResolver.kt +++ b/src/main/kotlin/space/whitememory/pythoninlayparams/types/hints/HintResolver.kt @@ -60,6 +60,12 @@ enum class HintResolver { typeEvalContext: TypeEvalContext, settings: PythonVariablesInlayTypeHintsProvider.Settings ): Boolean { + val assignedValue = PyUtil.peelArgument(element.findAssignedValue()) + + if (assignedValue is PyPrefixExpression) { + return shouldShowTypeHint(assignedValue.operand as PyElement, typeEvalContext) + } + return shouldShowTypeHint(element, typeEvalContext) } },