From 6db173c8e85e31d3af96bd965f4b9f5f25dfb9e3 Mon Sep 17 00:00:00 2001 From: Alex Berezhnykh Date: Mon, 12 Jun 2023 16:18:00 +0300 Subject: [PATCH] Tooltips: unify rendering --- .../src/QuickDoc/FSharpQuickDocProvider.fs | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/ReSharper.FSharp/src/FSharp.Psi.Daemon/src/QuickDoc/FSharpQuickDocProvider.fs b/ReSharper.FSharp/src/FSharp.Psi.Daemon/src/QuickDoc/FSharpQuickDocProvider.fs index 7a50189a31..8d064ac747 100644 --- a/ReSharper.FSharp/src/FSharp.Psi.Daemon/src/QuickDoc/FSharpQuickDocProvider.fs +++ b/ReSharper.FSharp/src/FSharp.Psi.Daemon/src/QuickDoc/FSharpQuickDocProvider.fs @@ -40,20 +40,28 @@ type FSharpQuickDocPresenter(xmlDocService: FSharpXmlDocService, identifier: IFS (RichText.Empty, text.GetFormattedParts()) ||> Seq.fold (fun result part -> result.Append(part.Text.Replace("<", "<").Replace(">", ">").Replace("\n", "
"), part.Style)) - let asContent (text: RichText) = - "
" + richTextEscapeToHtml text + "
" + let asContent text = + RichText("
", TextStyle.Default) + .Append(richTextEscapeToHtml text) + .Append("
", TextStyle.Default) //todo: move all the html related code to the platform - let asDefinition (text: RichText) = - "
" +
-        richTextEscapeToHtml text +
-        "
" - - let createToolTip (header: RichText) (body: RichText) = - if body.IsEmpty then - asContent header - else - (asDefinition header).Append(body) + let asDefinition text = + RichText("
", TextStyle.Default)
+         .Append(richTextEscapeToHtml text)
+         .Append("
", TextStyle.Default) + + let createToolTipLayout header (body: RichText) = + (asDefinition header).Append(body) + + let createTooltip (text: RichText) = + RichText(" + + + + ") + .Append(text) + .Append("") member x.CreateRichTextTooltip() = FSharpQuickDoc.getFSharpToolTipText identifier @@ -85,9 +93,10 @@ type FSharpQuickDocPresenter(xmlDocService: FSharpXmlDocService, identifier: IFS | _ -> () ] |> richTextJoin "\n\n" - createToolTip header body)) - |> richTextJoin IdentifierTooltipProvider.RIDER_TOOLTIP_SEPARATOR + createToolTipLayout header body)) + |> richTextJoin "" ) + |> Option.map createTooltip |> Option.defaultValue null interface IQuickDocPresenter with