Skip to content

Commit f64b68b

Browse files
authored
disable inline parameter hints for custom operations (#14517)
1 parent 35ebc15 commit f64b68b

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@ module InlineParameterNameHints =
6969
symbol.DeclaringEntity
7070
|> Option.exists (fun entity -> entity.CompiledName <> "Operators")
7171

72+
let isNotCustomOperation =
73+
not <| symbol.HasAttribute<CustomOperationAttribute>()
74+
7275
(symbol.IsFunction && isNotBuiltInOperator) // arguably, hints for those would be rather useless
7376
|| symbol.IsConstructor
74-
|| symbol.IsMethod
77+
|| (symbol.IsMethod && isNotCustomOperation)
7578
else
7679
false
7780

vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,17 @@ let test sequences =
478478

479479
let actual = getParameterNameHints document
480480

481-
Assert.AreEqual(expected, actual)
481+
Assert.AreEqual(expected, actual)
482+
483+
[<Test>]
484+
let ``Hints are not shown when CustomOperation attribute is detected`` () =
485+
let code =
486+
"""
487+
let q = query { for x in { 1 .. 10 } do select x }
488+
"""
489+
490+
let document = getFsDocument code
491+
492+
let actual = getParameterNameHints document
493+
494+
Assert.IsEmpty actual

0 commit comments

Comments
 (0)