From e9b339e016764e15f1dd68d4a614dd06b19520a9 Mon Sep 17 00:00:00 2001 From: "Vladimir.Krasnotsvetov" Date: Thu, 18 Jul 2024 19:10:59 +0200 Subject: [PATCH] fix #2452 (from github) GitOrigin-RevId: 6053f55d1d8ff1bc4e959ddd3030c6f5734affbd --- .../CodeAnnotations/OdinMinAttributeInformationProvider.cs | 3 +-- .../OdinRangeAttributesInformationProvider.cs | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinMinAttributeInformationProvider.cs b/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinMinAttributeInformationProvider.cs index 4e46a5893..22d3f5fdd 100644 --- a/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinMinAttributeInformationProvider.cs +++ b/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinMinAttributeInformationProvider.cs @@ -32,7 +32,6 @@ public long GetMinValue(IAttributeInstance attributeInstance) public long GetMaxValue(IAttributeInstance attributeInstance) { - var unityMaxValue = attributeInstance.PositionParameter(0); - return OdinCodeAnnotationUtil.GetMaxValue(unityMaxValue.ConstantValue); + return long.MaxValue; } } \ No newline at end of file diff --git a/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinRangeAttributesInformationProvider.cs b/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinRangeAttributesInformationProvider.cs index d551cab7b..99a77b42a 100644 --- a/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinRangeAttributesInformationProvider.cs +++ b/resharper/resharper-unity/src/Unity/Odin/Feature/Services/CodeAnnotations/OdinRangeAttributesInformationProvider.cs @@ -20,9 +20,13 @@ public bool IsApplicable(IAttributeInstance attributeInstance) return false; var unityMinValue = attributeInstance.PositionParameter(0); + var unityMaxValue = attributeInstance.PositionParameter(1); if (!OdinCodeAnnotationUtil.IsApplicable(unityMinValue.ConstantValue)) return false; + + if (!OdinCodeAnnotationUtil.IsApplicable(unityMaxValue.ConstantValue)) + return false; return true; } @@ -36,6 +40,7 @@ public long GetMinValue(IAttributeInstance attributeInstance) public long GetMaxValue(IAttributeInstance attributeInstance) { - return long.MaxValue; + var unityMinValue = attributeInstance.PositionParameter(1); + return OdinCodeAnnotationUtil.GetMaxValue(unityMinValue.ConstantValue); } } \ No newline at end of file