Skip to content

Commit

Permalink
In the Tooltip markdown, render generic type names with multiple segm…
Browse files Browse the repository at this point in the history
…ents correctly (#1298)

* fix wrong MD rendering when the generic type has multiple segments in it's name

* Adjust a test to cover a type name with multiple segments
  • Loading branch information
dawedawe authored May 20, 2024
1 parent 3f31b94 commit 592ed71
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/FsAutoComplete.Core/TipFormatter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,8 @@ let private formatTaggedText (t: TaggedText) : string =
| TextTag.StringLiteral
| TextTag.Text
| TextTag.Punctuation
| TextTag.UnknownType
| TextTag.UnknownEntity -> t.Text
| TextTag.UnknownType -> t.Text
| TextTag.UnknownEntity
| TextTag.Enum
| TextTag.Event
| TextTag.ActivePatternCase
Expand All @@ -1075,7 +1075,8 @@ let private formatUntaggedText (t: TaggedText) = t.Text

let private formatUntaggedTexts = Array.map formatUntaggedText >> String.concat ""

let private formatTaggedTexts = Array.map formatTaggedText >> String.concat ""
let private formatTaggedTexts =
Array.map formatTaggedText >> String.concat "" >> (fun s -> s.Replace("``", ""))

let private formatGenericParameters (typeMappings: TaggedText[] list) =
typeMappings
Expand Down
2 changes: 1 addition & 1 deletion test/FsAutoComplete.Tests.Lsp/CoreTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ let tooltipTests state =
""
"**Generic Parameters**"
""
"* `'T` is `string`" ] // verify fancy descriptions for external library functions
"* `'T` is `System.String`" ] // verify fancy descriptions for external library functions and correct backticks for multiple segments
verifyDescription
13
11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ let arrayOfTuples = [| 1, 2 |]
let listOfTuples = [ 1, 2 ]
let listOfStructTuples = [ struct(1, 2) ]
let floatThatShouldHaveGenericReportedInTooltip = 1.
sprintf "asd"
sprintf<System.String> "asd"

/// <summary>
/// My super summary
Expand Down

0 comments on commit 592ed71

Please sign in to comment.