From 1b15aa478018c8f74df3d1d8a39df44efc0eaec8 Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 13 Nov 2024 23:38:59 +0300 Subject: [PATCH 1/2] Code Vision: enable if inlay hints disabled at all --- .../src/Stages/InferredTypeCodeVisionProvider.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/InferredTypeCodeVisionProvider.fs b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/InferredTypeCodeVisionProvider.fs index 2c5ed5d65c..0e000c3f98 100644 --- a/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/InferredTypeCodeVisionProvider.fs +++ b/ReSharper.FSharp/src/FSharp/FSharp.Psi.Daemon/src/Stages/InferredTypeCodeVisionProvider.fs @@ -8,13 +8,10 @@ open JetBrains.Application.Settings open JetBrains.Application.UI.Components open JetBrains.Application.UI.PopupLayout open JetBrains.Application.UI.Tooltips -open JetBrains.ProjectModel open JetBrains.RdBackend.Common.Platform.CodeInsights open JetBrains.ReSharper.Daemon.CodeInsights open JetBrains.ReSharper.Feature.Services.Daemon open JetBrains.RdBackend.Common.Features.Services -open JetBrains.ReSharper.Plugins.FSharp -open JetBrains.ReSharper.Plugins.FSharp.Psi.Daemon.Options open JetBrains.ReSharper.Plugins.FSharp.Psi.Daemon.Resources open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Daemon.Stages open JetBrains.ReSharper.Plugins.FSharp.Psi.Features.Util @@ -27,6 +24,7 @@ open JetBrains.ReSharper.Resources.Shell open JetBrains.Rider.Model open JetBrains.TextControl.DocumentMarkup open JetBrains.TextControl.DocumentMarkup.Adornments +open JetBrains.TextControl.DocumentMarkup.Adornments.IntraTextAdornments open JetBrains.Util module FSharpInferredTypeHighlighting = @@ -143,6 +141,8 @@ and InferredTypeCodeVisionProviderProcess(fsFile, settings, daemonProcess, provi not Shell.Instance.IsTestShell && settingsStore.GetIndexedValue((fun (key: CodeInsightsSettings) -> key.DisabledProviders), FSharpInferredTypeHighlighting.providerId) || + + settingsStore.GetValue(fun (key: GeneralInlayHintsOptions) -> key.EnableInlayHints) && settingsStore.GetValue(fun (key: FSharpTypeHintOptions) -> key.ShowTypeHintsForTopLevelMembers) .EnsureInlayHintsDefault(settingsStore) <> PushToHintMode.Never From 1e62508a216d8ff813409cd66c0fa11d6059a30c Mon Sep 17 00:00:00 2001 From: "Alexey.Berezhnykh" Date: Wed, 13 Nov 2024 23:47:34 +0300 Subject: [PATCH 2/2] test --- .../Availability - Disabled inlay hints 01.fs | 3 +++ .../Availability - Disabled inlay hints 01.fs.gold | 6 ++++++ .../src/Daemon/InferredTypeCodeVisionProviderTest.fs | 5 +++++ 3 files changed, 14 insertions(+) create mode 100644 ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs create mode 100644 ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs.gold diff --git a/ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs b/ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs new file mode 100644 index 0000000000..35fa6db095 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs @@ -0,0 +1,3 @@ +module Module + +let x = 1 diff --git a/ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs.gold b/ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs.gold new file mode 100644 index 0000000000..3ed69e6e11 --- /dev/null +++ b/ReSharper.FSharp/test/data/features/daemon/inferredTypeCodeVision/Availability - Disabled inlay hints 01.fs.gold @@ -0,0 +1,6 @@ +module Module + +let |x|(0) = 1 + +--------------------------------------------------------- +(0): CodeInsights: int diff --git a/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Daemon/InferredTypeCodeVisionProviderTest.fs b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Daemon/InferredTypeCodeVisionProviderTest.fs index a71966121b..f9ec52f866 100644 --- a/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Daemon/InferredTypeCodeVisionProviderTest.fs +++ b/ReSharper.FSharp/test/src/FSharp.Intentions.Tests/src/Daemon/InferredTypeCodeVisionProviderTest.fs @@ -4,6 +4,7 @@ open JetBrains.ReSharper.Plugins.FSharp.Psi.Daemon.Stages open JetBrains.ReSharper.Plugins.FSharp.Settings open JetBrains.ReSharper.TestFramework open JetBrains.TextControl.DocumentMarkup.Adornments +open JetBrains.TextControl.DocumentMarkup.Adornments.IntraTextAdornments open NUnit.Framework [, "ShowTypeHintsForTopLevelMembers", PushToHintMode.Never)>] @@ -25,3 +26,7 @@ type InferredTypeCodeVisionProviderTest() = [] member x.``Binding - As 01``() = x.DoNamedTest() [] member x.``Binding - As 02 - Tuple``() = x.DoNamedTest() [] member x.``Binding - Paren 01``() = x.DoNamedTest() + + [, "EnableInlayHints", false)>] + [, "ShowTypeHintsForTopLevelMembers", PushToHintMode.Always)>] + [] member x.``Availability - Disabled inlay hints 01``() = x.DoNamedTest()