@@ -22,6 +22,7 @@ open Microsoft.VisualStudio.Text.Tagging
2222open Microsoft.VisualStudio .Shell
2323open Microsoft.VisualStudio .Shell .Interop
2424
25+ open Microsoft.FSharp .Compiler .Layout
2526open Microsoft.FSharp .Compiler .Parser
2627open Microsoft.FSharp .Compiler .Range
2728open Microsoft.FSharp .Compiler .SourceCodeServices
@@ -165,60 +166,28 @@ type internal FSharpSignatureHelpProvider
165166
166167 for method in methods do
167168 // Create the documentation. Note, do this on the background thread, since doing it in the documentationBuild fails to build the XML index
168- let summaryDoc = XmlDocumentation.BuildMethodOverloadTipText( documentationBuilder, method.Description, false )
169+ let mainDescription = List()
170+ let documentation = List()
171+ XmlDocumentation.BuildMethodOverloadTipText( documentationBuilder, CommonRoslynHelpers.CollectTaggedText mainDescription, CommonRoslynHelpers.CollectTaggedText documentation, method.StructuredDescription, false )
169172
170173 let parameters =
171174 let parameters = if isStaticArgTip then method.StaticParameters else method.Parameters
172175 [| for p in parameters do
176+ let doc = List()
173177 // FSROSLYNTODO: compute the proper help text for parameters, c.f. AppendParameter in XmlDocumentation.fs
174- let paramDoc = XmlDocumentation.BuildMethodParamText( documentationBuilder, method.XmlDoc, p.ParameterName)
175- let doc = if String.IsNullOrWhiteSpace( paramDoc) then [||]
176- else [| TaggedText( TextTags.Text, paramDoc) |]
177- let parameterParts =
178- if isStaticArgTip then
179- [| TaggedText( TextTags.Class, p.Display) |]
180- else
181- let str = p.Display
182- match str.IndexOf( ': ' ) with
183- | - 1 -> [| TaggedText( TextTags.Parameter, str) |]
184- | 0 ->
185- [| TaggedText( TextTags.Punctuation, " :" );
186- TaggedText( TextTags.Class, str.[ 1 ..]) |]
187- | i ->
188- [| TaggedText( TextTags.Parameter, str.[.. i-1 ]);
189- TaggedText( TextTags.Punctuation, " :" );
190- TaggedText( TextTags.Class, str.[ i+ 1 ..]) |]
191- yield ( p.ParameterName, p.IsOptional, doc, parameterParts)
178+ XmlDocumentation.BuildMethodParamText( documentationBuilder, CommonRoslynHelpers.CollectTaggedText doc, method.XmlDoc, p.ParameterName)
179+ let parts = List()
180+ renderL ( taggedTextListR ( CommonRoslynHelpers.CollectTaggedText parts)) p.StructuredDisplay |> ignore
181+ yield ( p.ParameterName, p.IsOptional, doc, parts)
192182 |]
193183
194- let hasParamComments ( pcs : ( string * bool * TaggedText []* TaggedText [])[]) =
195- pcs |> Array.exists ( fun ( _ , _ , doc , _ ) -> doc.Length > 0 )
196-
197- let summaryText =
198- let doc =
199- if String.IsNullOrWhiteSpace summaryDoc then
200- String.Empty
201- elif hasParamComments parameters then
202- summaryDoc + " \n "
203- else
204- summaryDoc
205- [| TaggedText( TextTags.Text, doc) |]
206-
207- // Prepare the text to display
208- let descriptionParts =
209- let str = method.TypeText
210- if str.StartsWith( " :" , StringComparison.OrdinalIgnoreCase) then
211- [| TaggedText( TextTags.Punctuation, " :" );
212- TaggedText( TextTags.Class, str.[ 1 ..]) |]
213- else
214- [| TaggedText( TextTags.Text, str) |]
215184 let prefixParts =
216185 [| TaggedText( TextTags.Method, methodGroup.MethodName);
217186 TaggedText( TextTags.Punctuation, ( if isStaticArgTip then " <" else " (" )) |]
218- let separatorParts = [| TaggedText( TextTags.Punctuation, " , " ) |]
187+ let separatorParts = [| TaggedText( TextTags.Punctuation, " ," ); TaggedText ( TextTags.Space , " " ) |]
219188 let suffixParts = [| TaggedText( TextTags.Punctuation, ( if isStaticArgTip then " >" else " )" )) |]
220189
221- let completionItem = ( method.HasParamArrayArg, summaryText , prefixParts, separatorParts, suffixParts, parameters, descriptionParts )
190+ let completionItem = ( method.HasParamArrayArg, documentation , prefixParts, separatorParts, suffixParts, parameters, mainDescription )
222191 // FSROSLYNTODO: Do we need a cache like for completion?
223192 //declarationItemsCache.Remove(completionItem.DisplayText) |> ignore // clear out stale entries if they exist
224193 //declarationItemsCache.Add(completionItem.DisplayText, declarationItem)
@@ -251,9 +220,9 @@ type internal FSharpSignatureHelpProvider
251220 results
252221 |> Array.map ( fun ( hasParamArrayArg , doc , prefixParts , separatorParts , suffixParts , parameters , descriptionParts ) ->
253222 let parameters = parameters
254- |> Array.map ( fun ( paramName , isOptional , paramDoc , displayParts ) ->
223+ |> Array.map ( fun ( paramName , isOptional , paramDoc , displayParts ) ->
255224 SignatureHelpParameter( paramName, isOptional, documentationFactory=( fun _ -> paramDoc :> seq < _ >), displayParts = displayParts ))
256- SignatureHelpItem( isVariadic= hasParamArrayArg , documentationFactory=( fun _ -> doc :> seq < _ >), prefixParts = prefixParts , separatorParts = separatorParts , suffixParts = suffixParts , parameters = parameters , descriptionParts = descriptionParts ))
225+ SignatureHelpItem( isVariadic= hasParamArrayArg, documentationFactory=( fun _ -> doc :> seq < _ >), prefixParts = prefixParts , separatorParts = separatorParts , suffixParts = suffixParts , parameters = parameters , descriptionParts = descriptionParts ))
257226
258227 return SignatureHelpItems( items, applicableSpan, argumentIndex, argumentCount, Option.toObj argumentName)
259228 with ex ->
0 commit comments