From f6694e693f05c6fb84a9a4fa23137419f4905a36 Mon Sep 17 00:00:00 2001 From: Petr Date: Fri, 28 Apr 2023 14:03:35 +0200 Subject: [PATCH 1/4] Add the test --- .../Hints/InlineParameterNameHintTests.fs | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs index d179a792629..0a59903c5e6 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs @@ -4,6 +4,7 @@ namespace FSharp.Editor.Tests.Hints open Xunit open HintTestFramework +open FSharp.Test module InlineParameterNameHintTests = @@ -599,3 +600,43 @@ None let actual = getParameterNameHints document Assert.Equal(expected, actual) + + [] + let ``Blah`` () = + let code = + """ +type X = | X of a: int list * b: string + +let x = X(List.map id [ 42 ], "") + """ + + let document = getFsDocument code + + let expected = + [ + { + Content = "a = " + Location = (3, 11) + Tooltip = "field a" + } + { + Content = "mapping = " + Location = (3, 20) + Tooltip = "parameter mapping" + } + { + Content = "list = " + Location = (3, 23) + Tooltip = "parameter list" + } + { + Content = "b = " + Location = (3, 31) + Tooltip = "field b" + } + ] + + let actual = getParameterNameHints document + + actual |> Assert.shouldBeEquivalentTo expected + From 0d9c5bd1824ffc48addd2237ccd797f3b8b7c000 Mon Sep 17 00:00:00 2001 From: Petr Date: Fri, 28 Apr 2023 16:19:32 +0200 Subject: [PATCH 2/4] Hopefully fix --- .../src/FSharp.Editor/Hints/InlineParameterNameHints.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs index ef6a49413dc..22affc41a77 100644 --- a/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs +++ b/vsintegration/src/FSharp.Editor/Hints/InlineParameterNameHints.fs @@ -123,7 +123,7 @@ type InlineParameterNameHints(parseResults: FSharpParseFileResults) = let curryRanges = getCurryRanges symbolUse let ranges = - if Seq.isEmpty tupleRanges then + if symbol.IsFunction || Seq.isEmpty tupleRanges then curryRanges |> List.toSeq else tupleRanges From 75ca4eb4e0230d10c71729f8e2fb0ba0283daadb Mon Sep 17 00:00:00 2001 From: Petr Date: Fri, 28 Apr 2023 16:24:33 +0200 Subject: [PATCH 3/4] up --- .../FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs index 0a59903c5e6..a60de6d5d58 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs @@ -602,7 +602,7 @@ None Assert.Equal(expected, actual) [] - let ``Blah`` () = + let ``Hints are shown correctly in type constructors mixed with functions`` () = let code = """ type X = | X of a: int list * b: string From 1ff9e44eda8151ccdc7876a53cccbe28b5b91287 Mon Sep 17 00:00:00 2001 From: Petr Date: Fri, 28 Apr 2023 17:58:47 +0200 Subject: [PATCH 4/4] Update InlineParameterNameHintTests.fs --- .../FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs | 1 - 1 file changed, 1 deletion(-) diff --git a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs index a60de6d5d58..1607662a96c 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/Hints/InlineParameterNameHintTests.fs @@ -639,4 +639,3 @@ let x = X(List.map id [ 42 ], "") let actual = getParameterNameHints document actual |> Assert.shouldBeEquivalentTo expected -