@@ -22,6 +22,7 @@ open Microsoft.VisualStudio.Text.Tagging
22
22
open Microsoft.VisualStudio .Shell
23
23
open Microsoft.VisualStudio .Shell .Interop
24
24
25
+ open Microsoft.FSharp .Compiler .Layout
25
26
open Microsoft.FSharp .Compiler .Parser
26
27
open Microsoft.FSharp .Compiler .Range
27
28
open Microsoft.FSharp .Compiler .SourceCodeServices
@@ -165,60 +166,28 @@ type internal FSharpSignatureHelpProvider
165
166
166
167
for method in methods do
167
168
// 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 )
169
172
170
173
let parameters =
171
174
let parameters = if isStaticArgTip then method.StaticParameters else method.Parameters
172
175
[| for p in parameters do
176
+ let doc = List()
173
177
// 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)
192
182
|]
193
183
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) |]
215
184
let prefixParts =
216
185
[| TaggedText( TextTags.Method, methodGroup.MethodName);
217
186
TaggedText( TextTags.Punctuation, ( if isStaticArgTip then " <" else " (" )) |]
218
- let separatorParts = [| TaggedText( TextTags.Punctuation, " , " ) |]
187
+ let separatorParts = [| TaggedText( TextTags.Punctuation, " ," ); TaggedText ( TextTags.Space , " " ) |]
219
188
let suffixParts = [| TaggedText( TextTags.Punctuation, ( if isStaticArgTip then " >" else " )" )) |]
220
189
221
- let completionItem = ( method.HasParamArrayArg, summaryText , prefixParts, separatorParts, suffixParts, parameters, descriptionParts )
190
+ let completionItem = ( method.HasParamArrayArg, documentation , prefixParts, separatorParts, suffixParts, parameters, mainDescription )
222
191
// FSROSLYNTODO: Do we need a cache like for completion?
223
192
//declarationItemsCache.Remove(completionItem.DisplayText) |> ignore // clear out stale entries if they exist
224
193
//declarationItemsCache.Add(completionItem.DisplayText, declarationItem)
@@ -251,9 +220,9 @@ type internal FSharpSignatureHelpProvider
251
220
results
252
221
|> Array.map ( fun ( hasParamArrayArg , doc , prefixParts , separatorParts , suffixParts , parameters , descriptionParts ) ->
253
222
let parameters = parameters
254
- |> Array.map ( fun ( paramName , isOptional , paramDoc , displayParts ) ->
223
+ |> Array.map ( fun ( paramName , isOptional , paramDoc , displayParts ) ->
255
224
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 ))
257
226
258
227
return SignatureHelpItems( items, applicableSpan, argumentIndex, argumentCount, Option.toObj argumentName)
259
228
with ex ->
0 commit comments