From 5baff0007ac1007e8ee2200fbac5bb29a2d089a5 Mon Sep 17 00:00:00 2001 From: Ross Kuehl <94796738+rosskuehl@users.noreply.github.com> Date: Wed, 28 Dec 2022 13:50:11 -0500 Subject: [PATCH] disable inline parameter hints for custom operations --- .../Hints/InlineParameterNameHints.fs | 5 ++++- .../Hints/InlineParameterNameHintTests.fs | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs index d427818832..5e1a7f969e 100644 --- a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs @@ -70,9 +70,12 @@ module InlineParameterNameHints = symbol.DeclaringEntity |> Option.exists (fun entity -> entity.CompiledName <> "Operators") + let isNotCustomOperation = + not <| symbol.HasAttribute() + (symbol.IsFunction && isNotBuiltInOperator) // arguably, hints for those would be rather useless || symbol.IsConstructor - || symbol.IsMethod + || (symbol.IsMethod && isNotCustomOperation) else false diff --git a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs index 998cb78bdc..60b7fa0f0e 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs @@ -478,4 +478,17 @@ let test sequences = let actual = getParameterNameHints document - Assert.AreEqual(expected, actual) \ No newline at end of file + Assert.AreEqual(expected, actual) + + [] + let ``Hints are not shown when CustomOperation attribute is detected`` () = + let code = + """ +let q = query { for x in { 1 .. 10 } do select x } +""" + + let document = getFsDocument code + + let actual = getParameterNameHints document + + Assert.IsEmpty actual \ No newline at end of file