Skip to content

Commit 8e7a1e6

Browse files
authored
Remove blocking members from FSharpDeclarationListItem (#9187)
1 parent c904844 commit 8e7a1e6

3 files changed

Lines changed: 1 addition & 48 deletions

File tree

src/fsharp/service/ServiceDeclarationLists.fs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@ open FSharp.Compiler.Range
2323
open FSharp.Compiler.TypedTree
2424
open FSharp.Compiler.TypedTreeOps
2525

26-
[<AutoOpen>]
27-
module EnvMisc3 =
28-
/// dataTipSpinWaitTime limits how long we block the UI thread while a tooltip pops up next to a selected item in an IntelliSense completion list.
29-
/// This time appears to be somewhat amortized by the time it takes the VS completion UI to actually bring up the tooltip after selecting an item in the first place.
30-
let dataTipSpinWaitTime = GetEnvInteger "FCS_ToolTipSpinWaitTime" 5000
31-
32-
3326
[<Sealed>]
3427
/// Represents one parameter for one method (or other item) in a group.
3528
type FSharpMethodGroupItemParameter(name: string, canonicalTypeTextForSorting: string, display: layout, isOptional: bool) =
@@ -482,10 +475,6 @@ module internal DescriptionListsImpl =
482475
[<Sealed>]
483476
type FSharpDeclarationListItem(name: string, nameInCode: string, fullName: string, glyph: FSharpGlyph, info, accessibility: FSharpAccessibility option,
484477
kind: CompletionItemKind, isOwnMember: bool, priority: int, isResolved: bool, namespaceToOpen: string option) =
485-
486-
let mutable descriptionTextHolder: FSharpToolTipText<_> option = None
487-
let mutable task = null
488-
489478
member __.Name = name
490479
member __.NameInCode = nameInCode
491480

@@ -505,34 +494,6 @@ type FSharpDeclarationListItem(name: string, nameInCode: string, fullName: strin
505494
decl.StructuredDescriptionTextAsync
506495
|> Tooltips.Map Tooltips.ToFSharpToolTipText
507496

508-
member decl.StructuredDescriptionText =
509-
ErrorScope.Protect Range.range0
510-
(fun () ->
511-
match descriptionTextHolder with
512-
| Some descriptionText -> descriptionText
513-
| None ->
514-
match info with
515-
| Choice1Of2 _ ->
516-
// The dataTipSpinWaitTime limits how long we block the UI thread while a tooltip pops up next to a selected item in an IntelliSense completion list.
517-
// This time appears to be somewhat amortized by the time it takes the VS completion UI to actually bring up the tooltip after selecting an item in the first place.
518-
if isNull task then
519-
// kick off the actual (non-cooperative) work
520-
task <- System.Threading.Tasks.Task.Factory.StartNew(fun() ->
521-
let text = decl.StructuredDescriptionTextAsync |> Async.RunSynchronously
522-
descriptionTextHolder <- Some text)
523-
524-
// The dataTipSpinWaitTime limits how long we block the UI thread while a tooltip pops up next to a selected item in an IntelliSense completion list.
525-
// This time appears to be somewhat amortized by the time it takes the VS completion UI to actually bring up the tooltip after selecting an item in the first place.
526-
task.Wait EnvMisc3.dataTipSpinWaitTime |> ignore
527-
match descriptionTextHolder with
528-
| Some text -> text
529-
| None -> FSharpToolTipText [ FSharpStructuredToolTipElement.Single(wordL (tagText (FSComp.SR.loadingDescription())), FSharpXmlDoc.None) ]
530-
531-
| Choice2Of2 result ->
532-
result
533-
)
534-
(fun err -> FSharpToolTipText [FSharpStructuredToolTipElement.CompositionError err])
535-
member decl.DescriptionText = decl.StructuredDescriptionText |> Tooltips.ToFSharpToolTipText
536497
member __.Glyph = glyph
537498
member __.Accessibility = accessibility
538499
member __.Kind = kind

src/fsharp/service/ServiceDeclarationLists.fsi

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ type public FSharpDeclarationListItem =
2020
/// Get the name for the declaration as it's presented in source code.
2121
member NameInCode : string
2222

23-
/// Get the description text for the declaration. Computing this property may require using compiler
24-
/// resources and may trigger execution of a type provider method to retrieve documentation.
25-
///
26-
/// May return "Loading..." if timeout occurs
27-
member StructuredDescriptionText : FSharpStructuredToolTipText
28-
29-
member DescriptionText : FSharpToolTipText
30-
3123
/// Get the description text, asynchronously. Never returns "Loading...".
3224
member StructuredDescriptionTextAsync : Async<FSharpStructuredToolTipText>
3325

vsintegration/src/FSharp.LanguageService/Intellisense.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ type internal FSharpDeclarations_DEPRECATED(documentationBuilder, declarations:
183183
let decls = trimmedDeclarations filterText
184184
if (index >= 0 && index < decls.Length) then
185185
let buf = Text.StringBuilder()
186-
XmlDocumentation.BuildDataTipText_DEPRECATED(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, decls.[index].StructuredDescriptionText)
186+
XmlDocumentation.BuildDataTipText_DEPRECATED(documentationBuilder, TaggedText.appendTo buf, TaggedText.appendTo buf, decls.[index].StructuredDescriptionTextAsync |> Async.RunSynchronously)
187187
buf.ToString()
188188
else ""
189189

0 commit comments

Comments
 (0)