@@ -18,7 +18,6 @@ open FSharp.Compiler.Syntax
1818open FSharp.Compiler .Text
1919open FSharp.Compiler .Text .Position
2020open FSharp.Compiler .Text .Range
21- open FSharp.Compiler .Text
2221open FSharp.Compiler .Tokenization
2322
2423type SignatureHelpParameterInfo =
@@ -170,7 +169,7 @@ type internal FSharpSignatureHelpProvider
170169 | n -> n
171170
172171 // Compute the current argument name if it is named.
173- let argumentName =
172+ let namedArgumentName =
174173 if argumentIndex < paramLocations.NamedParamNames.Length then
175174 paramLocations.NamedParamNames.[ argumentIndex]
176175 else
@@ -223,7 +222,7 @@ type internal FSharpSignatureHelpProvider
223222 ApplicableSpan = applicableSpan
224223 ArgumentIndex = argumentIndex
225224 ArgumentCount = argumentCount
226- ArgumentName = argumentName
225+ ArgumentName = namedArgumentName
227226 CurrentSignatureHelpSessionKind = MethodCall }
228227
229228 return ! Some data
@@ -280,7 +279,7 @@ type internal FSharpSignatureHelpProvider
280279 | None -> 0
281280 | Some (_, numArgsApplied) -> numArgsApplied
282281
283- let definedArgs = mfv.CurriedParameterGroups |> Seq.concat |> Array.ofSeq
282+ let definedArgs = mfv.CurriedParameterGroups |> Array.ofSeq
284283
285284 let numDefinedArgs = definedArgs.Length
286285
@@ -360,40 +359,97 @@ type internal FSharpSignatureHelpProvider
360359 // Offset by 1 here until we support reverse indexes in this codebase
361360 definedArgs.[.. definedArgs.Length - 1 - numArgsAlreadyApplied] |> Array.iteri ( fun index argument ->
362361 let tt = ResizeArray()
363- let taggedText = argument.Type.FormatLayout symbolUse.DisplayContext
364- taggedText |> Seq.iter ( RoslynHelpers.CollectTaggedText tt)
362+
363+ if argument.Count = 1 then
364+ let argument = argument.[ 0 ]
365+ let taggedText = argument.Type.FormatLayout symbolUse.DisplayContext
366+ taggedText |> Seq.iter ( RoslynHelpers.CollectTaggedText tt)
365367
366- let name =
367- if String.IsNullOrWhiteSpace( argument.DisplayName) then
368- " arg" + string index
369- else
370- argument.DisplayName
368+ let name =
369+ if String.IsNullOrWhiteSpace( argument.DisplayName) then
370+ " arg" + string index
371+ else
372+ argument.DisplayName
373+
374+ let display =
375+ [|
376+ RoslynTaggedText( TextTags.Local, name)
377+ RoslynTaggedText( TextTags.Punctuation, " :" )
378+ RoslynTaggedText( TextTags.Space, " " )
379+ |]
380+ |> ResizeArray
381+
382+ if argument.Type.IsFunctionType then
383+ display.Add( RoslynTaggedText( TextTags.Punctuation, " (" ))
384+
385+ display.AddRange( tt)
371386
372- let display =
373- [|
374- RoslynTaggedText( TextTags.Local, name)
375- RoslynTaggedText( TextTags.Punctuation, " :" )
376- RoslynTaggedText( TextTags.Space, " " )
377- |]
378- |> ResizeArray
387+ if argument.Type.IsFunctionType then
388+ display.Add( RoslynTaggedText( TextTags.Punctuation, " )" ))
379389
380- if argument.Type.IsFunctionType then
390+ let info =
391+ { ParameterName = name
392+ IsOptional = false
393+ CanonicalTypeTextForSorting = name
394+ Documentation = ResizeArray()
395+ DisplayParts = display }
396+
397+ displayArgs.Add( info)
398+ else
399+ let display = ResizeArray()
381400 display.Add( RoslynTaggedText( TextTags.Punctuation, " (" ))
382401
383- display.AddRange( tt)
402+ let separatorParts =
403+ [|
404+ RoslynTaggedText( TextTags.Space, " " )
405+ RoslynTaggedText( TextTags.Operator, " *" )
406+ RoslynTaggedText( TextTags.Space, " " )
407+ |]
384408
385- if argument.Type.IsFunctionType then
409+ let mutable first = true
410+ argument |> Seq.iteri ( fun index arg ->
411+ if first then
412+ first <- false
413+ else
414+ display.AddRange( separatorParts)
415+ let tt = ResizeArray()
416+
417+ let taggedText = arg.Type.FormatLayout symbolUse.DisplayContext
418+ taggedText |> Seq.iter ( RoslynHelpers.CollectTaggedText tt)
419+
420+ let name =
421+ if String.IsNullOrWhiteSpace( arg.DisplayName) then
422+ " arg" + string index
423+ else
424+ arg.DisplayName
425+
426+ let namePart =
427+ [|
428+ RoslynTaggedText( TextTags.Local, name)
429+ RoslynTaggedText( TextTags.Punctuation, " :" )
430+ RoslynTaggedText( TextTags.Space, " " )
431+ |]
432+
433+ display.AddRange( namePart)
434+
435+ if arg.Type.IsFunctionType then
436+ display.Add( RoslynTaggedText( TextTags.Punctuation, " (" ))
437+
438+ display.AddRange( tt)
439+
440+ if arg.Type.IsFunctionType then
441+ display.Add( RoslynTaggedText( TextTags.Punctuation, " )" )))
442+
386443 display.Add( RoslynTaggedText( TextTags.Punctuation, " )" ))
444+
445+ let info =
446+ { ParameterName = " " // No name here, since it's a tuple of arguments has no name in the F# symbol info
447+ IsOptional = false
448+ CanonicalTypeTextForSorting = " "
449+ Documentation = ResizeArray()
450+ DisplayParts = display }
387451
388- let info =
389- { ParameterName = name
390- IsOptional = false
391- // No need to do anything different here, as this field is only relevant for overloaded parameter names in methods.
392- CanonicalTypeTextForSorting = name
393- Documentation = ResizeArray()
394- DisplayParts = display }
395-
396- displayArgs.Add( info))
452+ displayArgs.Add( info))
397453
398454 do ! Option.guard ( displayArgs.Count > 0 )
399455
@@ -509,7 +565,7 @@ type internal FSharpSignatureHelpProvider
509565 checkFileResults,
510566 documentationBuilder,
511567 sourceText,
512- adjustedColumnInSource ,
568+ caretPosition ,
513569 triggerTypedChar)
514570 }
515571
0 commit comments