@@ -23,8 +23,8 @@ open Microsoft.FSharp.Compiler
2323
2424open Internal.Utilities .StructuredFormat
2525
26- type private TooltipInfo =
27- { StructuredText: FSharpStructuredToolTipText
26+ type private QuickInfo =
27+ { StructuredText: FSharpStructuredToolTipText
2828 Span: TextSpan
2929 Symbol: FSharpSymbol
3030 SymbolKind: LexerSymbolKind }
@@ -35,17 +35,17 @@ module private FSharpQuickInfo =
3535
3636// when a construct has been declared in a signature file the documentation comments that are
3737// written in that file are the ones that go into the generated xml when the project is compiled
38- // therefore we should include these doccoms in our design timetooltips
39- let getTooltipFromRange
38+ // therefore we should include these doccoms in our design timequick info
39+ let getQuickInfoFromRange
4040(
41- checker : FSharpChecker ,
42- projectInfoManager : FSharpProjectOptionsManager ,
43- document : Document ,
44- declRange : range ,
41+ checker : FSharpChecker ,
42+ projectInfoManager : FSharpProjectOptionsManager ,
43+ document : Document ,
44+ declRange : range ,
4545cancellationToken : CancellationToken
46- )
47- : Async < TooltipInfo option > =
48-
46+ )
47+ : Async < QuickInfo option > =
48+
4949asyncMaybe {
5050let solution = document.Project.Solution
5151// ascertain the location of the target declaration in the signature file
@@ -54,41 +54,41 @@ module private FSharpQuickInfo =
5454let! extSourceText = extDocument.GetTextAsync cancellationToken
5555let! extSpan = RoslynHelpers.TryFSharpRangeToTextSpan( extSourceText, declRange)
5656let extLineText = ( extSourceText.Lines.GetLineFromPosition extSpan.Start). ToString()
57-
58- // project options need to be retrieved because the signature file could be in another project
57+
58+ // project options need to be retrieved because the signature file could be in another project
5959let! extParsingOptions , _extSite , extProjectOptions = projectInfoManager.TryGetOptionsForProject extDocId.ProjectId
6060let extDefines = CompilerEnvironment.GetCompilationDefinesForEditing extParsingOptions
6161let! extLexerSymbol = Tokenizer.getSymbolAtPosition( extDocId, extSourceText, extSpan.Start, declRange.FileName, extDefines, SymbolLookupKind.Greedy, true )
6262let! _ , _ , extCheckFileResults = checker.ParseAndCheckDocument( extDocument, extProjectOptions, allowStaleResults= true , sourceText= extSourceText, userOpName= userOpName)
63-
64- let! extTooltipText =
63+
64+ let! extQuickInfoText =
6565 extCheckFileResults.GetStructuredToolTipText
6666( declRange.StartLine, extLexerSymbol.Ident.idRange.EndColumn, extLineText, extLexerSymbol.FullIsland, FSharpTokenTag.IDENT, userOpName= userOpName) |> liftAsync
67-
68- match extTooltipText with
69- | FSharpToolTipText[]
67+
68+ match extQuickInfoText with
69+ | FSharpToolTipText[]
7070| FSharpToolTipText[ FSharpStructuredToolTipElement.None] -> return ! None
71- | extTooltipText ->
71+ | extQuickInfoText ->
7272let! extSymbolUse =
7373 extCheckFileResults.GetSymbolUseAtLocation( declRange.StartLine, extLexerSymbol.Ident.idRange.EndColumn, extLineText, extLexerSymbol.FullIsland, userOpName= userOpName)
7474let! span = RoslynHelpers.TryFSharpRangeToTextSpan( extSourceText, extLexerSymbol.Range)
75-
76- return { StructuredText= extTooltipText
75+
76+ return { StructuredText= extQuickInfoText
7777 Span= span
7878 Symbol= extSymbolUse.Symbol
7979 SymbolKind= extLexerSymbol.Kind}
8080}
8181
82- /// Gettooltip combined from doccom of Signature and definition
83- let getTooltipInfo
82+ /// GetQuickInfo combined from doccom of Signature and definition
83+ let getQuickInfo
8484(
85- checker : FSharpChecker ,
86- projectInfoManager : FSharpProjectOptionsManager ,
87- document : Document ,
88- position : int ,
85+ checker : FSharpChecker ,
86+ projectInfoManager : FSharpProjectOptionsManager ,
87+ document : Document ,
88+ position : int ,
8989cancellationToken : CancellationToken
90- )
91- : Async <( FSharpSymbolUse * TooltipInfo option* TooltipInfo option) option > =
90+ )
91+ : Async <( FSharpSymbolUse * QuickInfo option* QuickInfo option) option > =
9292
9393asyncMaybe {
9494let! sourceText = document.GetTextAsync cancellationToken
@@ -101,60 +101,60 @@ module private FSharpQuickInfo =
101101let fcsTextLineNumber = Line.fromZ textLinePos.Line
102102let lineText = ( sourceText.Lines.GetLineFromPosition position). ToString()
103103let! symbolUse = checkFileResults.GetSymbolUseAtLocation( fcsTextLineNumber, idRange.EndColumn, lineText, lexerSymbol.FullIsland, userOpName= userOpName)
104-
105- /// Gets thetooltip information for the orignal target
106- let getTargetSymbolTooltip () =
104+
105+ /// Gets theQuickInfo information for the orignal target
106+ let getTargetSymbolQuickInfo () =
107107asyncMaybe {
108- let! targetTooltip =
108+ let! targetQuickInfo =
109109 checkFileResults.GetStructuredToolTipText
110110( fcsTextLineNumber, idRange.EndColumn, lineText, lexerSymbol.FullIsland, FSharpTokenTag.IDENT, userOpName= userOpName) |> liftAsync
111-
112- match targetTooltip with
113- | FSharpToolTipText[]
111+
112+ match targetQuickInfo with
113+ | FSharpToolTipText[]
114114| FSharpToolTipText[ FSharpStructuredToolTipElement.None] -> return ! None
115- | _ ->
115+ | _ ->
116116let! targetTextSpan = RoslynHelpers.TryFSharpRangeToTextSpan( sourceText, lexerSymbol.Range)
117- return { StructuredText= targetTooltip
117+ return { StructuredText= targetQuickInfo
118118 Span= targetTextSpan
119119 Symbol= symbolUse.Symbol
120120 SymbolKind= lexerSymbol.Kind}
121- }
121+ }
122122
123- // if the target is in a signature file, adjusting thetooltip info is unnecessary
123+ // if the target is in a signature file, adjusting thequick info is unnecessary
124124if isSignatureFile document.FilePaththen
125- let! targetTooltipInfo = getTargetSymbolTooltip ()
126- return symbolUse, None, SometargetTooltipInfo
125+ let! targetQuickInfo = getTargetSymbolQuickInfo ()
126+ return symbolUse, None, SometargetQuickInfo
127127else
128128// find the declaration location of the target symbol, with a preference for signature files
129129let! findSigDeclarationResult = checkFileResults.GetDeclarationLocation( idRange.StartLine, idRange.EndColumn, lineText, lexerSymbol.FullIsland, preferFlag= true , userOpName= userOpName) |> liftAsync
130-
131- // it is necessary to retrieve the backuptooltip info because this acquires
132- // the textSpan designating where we want thetooltip to appear.
133- let! targetTooltipInfo = getTargetSymbolTooltip ()
134-
130+
131+ // it is necessary to retrieve the backupquick info because this acquires
132+ // the textSpan designating where we want thequick info to appear.
133+ let! targetQuickInfo = getTargetSymbolQuickInfo ()
134+
135135let! result =
136136match findSigDeclarationResultwith
137137| FSharpFindDeclResult.DeclFound declRangewhen isSignatureFile declRange.FileName->
138138asyncMaybe {
139- let! sigTooltipInfo = getTooltipFromRange ( checker, projectInfoManager, document, declRange, cancellationToken)
140-
139+ let! sigQuickInfo = getQuickInfoFromRange ( checker, projectInfoManager, document, declRange, cancellationToken)
140+
141141// if the target was declared in a signature file, and the current file
142142// is not the corresponding module implementation file for that signature,
143- // the doccoms from the signature will overwrite any doccoms that might be
143+ // the doccoms from the signature will overwrite any doccoms that might be
144144// present on the definition/implementation
145- let! findImplDefinitionResult = checkFileResults.GetDeclarationLocation( idRange.StartLine, idRange.EndColumn, lineText, lexerSymbol.FullIsland, preferFlag= false , userOpName= userOpName) |> liftAsync
146-
147- match findImplDefinitionResultwith
148- | FSharpFindDeclResult.DeclNotFound_
149- | FSharpFindDeclResult.ExternalDecl_ -> return symbolUse, SomesigTooltipInfo , None
150- | FSharpFindDeclResult.DeclFound declRange->
151- let! implTooltipInfo = getTooltipFromRange ( checker, projectInfoManager, document, declRange, cancellationToken)
152- return symbolUse, SomesigTooltipInfo , Some{ implTooltipInfo with Span= targetTooltipInfo .Span}
145+ let! findImplDefinitionResult = checkFileResults.GetDeclarationLocation( idRange.StartLine, idRange.EndColumn, lineText, lexerSymbol.FullIsland, preferFlag= false , userOpName= userOpName) |> liftAsync
146+
147+ match findImplDefinitionResultwith
148+ | FSharpFindDeclResult.DeclNotFound_
149+ | FSharpFindDeclResult.ExternalDecl_ -> return symbolUse, SomesigQuickInfo , None
150+ | FSharpFindDeclResult.DeclFound declRange->
151+ let! implQuickInfo = getQuickInfoFromRange ( checker, projectInfoManager, document, declRange, cancellationToken)
152+ return symbolUse, SomesigQuickInfo , Some{ implQuickInfo with Span= targetQuickInfo .Span}
153153}
154154| _ -> async.Return None
155155|> liftAsync
156-
157- return result|> Option.defaultValue( symbolUse, None, SometargetTooltipInfo )
156+
157+ return result|> Option.defaultValue( symbolUse, None, SometargetQuickInfo )
158158}
159159
160160type internal FSharpAsyncQuickInfoSource
@@ -196,26 +196,26 @@ type internal FSharpAsyncQuickInfoSource
196196let documentationBuilder = XmlDocumentation.CreateDocumentationBuilder( xmlMemberIndexService, serviceProvider.DTE)
197197asyncMaybe {
198198let document = textBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges()
199- let! symbolUse , sigTooltipInfo , targetTooltipInfo = FSharpQuickInfo.getTooltipInfo ( checkerProvider.Checker, projectInfoManager, document, triggerPoint.Position, cancellationToken)
199+ let! symbolUse , sigQuickInfo , targetQuickInfo = FSharpQuickInfo.getQuickInfo ( checkerProvider.Checker, projectInfoManager, document, triggerPoint.Position, cancellationToken)
200200let getTrackingSpan ( span : TextSpan ) =
201201 textBuffer.CurrentSnapshot.CreateTrackingSpan( span.Start, span.Length, SpanTrackingMode.EdgeInclusive)
202202
203- match sigTooltipInfo , targetTooltipInfo with
203+ match sigQuickInfo , targetQuickInfo with
204204| None, None-> return null
205- | Sometooltip , None
206- | None, Sometooltip ->
205+ | SomequickInfo , None
206+ | None, SomequickInfo ->
207207let mainDescription , documentation , typeParameterMap , usage , exceptions = ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray()
208- XmlDocumentation.BuildDataTipText( documentationBuilder, mainDescription.Add, documentation.Add, typeParameterMap.Add, usage.Add, exceptions.Add, tooltip .StructuredText)
209- let imageId = Tokenizer.GetImageIdForSymbol( tooltip .Symbol, tooltip .SymbolKind)
208+ XmlDocumentation.BuildDataTipText( documentationBuilder, mainDescription.Add, documentation.Add, typeParameterMap.Add, usage.Add, exceptions.Add, quickInfo .StructuredText)
209+ let imageId = Tokenizer.GetImageIdForSymbol( quickInfo .Symbol, quickInfo .SymbolKind)
210210let navigation = QuickInfoNavigation( gotoDefinitionService, document, symbolUse.RangeAlternate)
211211let content = QuickInfoViewProvider.provideContent( imageId, mainDescription, documentation, typeParameterMap, usage, exceptions, navigation)
212- let span = getTrackingSpantooltip .Span
212+ let span = getTrackingSpanquickInfo .Span
213213return QuickInfoItem( span, content)
214214
215- | SomesigTooltip , SometargetTooltip ->
215+ | SomesigQuickInfo , SometargetQuickInfo ->
216216let mainDescription , targetDocumentation , sigDocumentation , typeParameterMap , exceptions , usage = ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray(), ResizeArray()
217- XmlDocumentation.BuildDataTipText( documentationBuilder, ignore, sigDocumentation.Add, ignore, ignore, ignore, sigTooltip .StructuredText)
218- XmlDocumentation.BuildDataTipText( documentationBuilder, mainDescription.Add, targetDocumentation.Add, typeParameterMap.Add, exceptions.Add, usage.Add, targetTooltip .StructuredText)
217+ XmlDocumentation.BuildDataTipText( documentationBuilder, ignore, sigDocumentation.Add, ignore, ignore, ignore, sigQuickInfo .StructuredText)
218+ XmlDocumentation.BuildDataTipText( documentationBuilder, mainDescription.Add, targetDocumentation.Add, typeParameterMap.Add, exceptions.Add, usage.Add, targetQuickInfo .StructuredText)
219219
220220let width =
221221 mainDescription
@@ -242,28 +242,28 @@ type internal FSharpAsyncQuickInfoSource
242242if String.IsNullOrWhiteSpace tt.Textthen sbelse sb.Append tt.Text)
243243|> string
244244if String.IsNullOrWhiteSpace textthen Noneelse Some text
245-
246- let documentation =
245+
246+ let documentation =
247247[ match getText targetDocumentation, getText sigDocumentationwith
248248| None, None-> ()
249249| None, Some_ -> yield ! sigDocumentation
250250| Some_, None-> yield ! targetDocumentation
251251| Some implText, Some sigTextwhen implText.Equals( sigText, StringComparison.OrdinalIgnoreCase) ->
252252yield ! sigDocumentation
253- | Some_ , Some_ ->
253+ | Some_ , Some_ ->
254254yield ! sigDocumentation
255255yield lineBreak
256256yield seperator
257257yield lineBreak
258258yield ! targetDocumentation]
259259|> ResizeArray
260- let imageId = Tokenizer.GetImageIdForSymbol( targetTooltip .Symbol, targetTooltip .SymbolKind)
260+ let imageId = Tokenizer.GetImageIdForSymbol( targetQuickInfo .Symbol, targetQuickInfo .SymbolKind)
261261let navigation = QuickInfoNavigation( gotoDefinitionService, document, symbolUse.RangeAlternate)
262262let content = QuickInfoViewProvider.provideContent( imageId, mainDescription, documentation, typeParameterMap, usage, exceptions, navigation)
263- let span = getTrackingSpantargetTooltip .Span
263+ let span = getTrackingSpantargetQuickInfo .Span
264264return QuickInfoItem( span, content)
265265} |> Async.map Option.toObj
266- |> RoslynHelpers.StartAsyncAsTask cancellationToken
266+ |> RoslynHelpers.StartAsyncAsTask cancellationToken
267267
268268[<Export( typeof< IAsyncQuickInfoSourceProvider>) >]
269269[<Name( " F# Quick Info Provider" ) >]