Skip to content

Commit

Permalink
Don't add empty line if there are no generic parameters.
Browse files Browse the repository at this point in the history
This mimic the old behaviours and should fix the remaining tests
  • Loading branch information
Maxime Mangel committed Apr 7, 2023
1 parent 0124000 commit f9cce33
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/FsAutoComplete.Core/TipFormatter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ let private tryComputeTooltipInfo (ToolTipText tips) (formatCommentStyle: Format
let computeGenericParametersText (tooltipData: ToolTipElementData) =
// If there are no generic parameters, don't display the section
if tooltipData.TypeMapping.IsEmpty then
""
None
// If there are generic parameters, display the section
else
nl
Expand All @@ -1143,6 +1143,7 @@ let private tryComputeTooltipInfo (ToolTipText tips) (formatCommentStyle: Format
+ nl
+ nl
+ formatGenericParameters tooltipData.TypeMapping
|> Some

tips
// Render the first valid tooltip and return it
Expand All @@ -1156,13 +1157,20 @@ let private tryComputeTooltipInfo (ToolTipText tips) (formatCommentStyle: Format

// Concatenate the doc comment and the generic parameters section
let consolidatedDocCommentText =
docCommentText + nl + nl + computeGenericParametersText tooltipData
match computeGenericParametersText tooltipData with
| Some genericParametersText -> docCommentText + nl + nl + genericParametersText
| None -> docCommentText

consolidatedDocCommentText, xmlDoc.HasTruncatedExamples

| TryGetXmlDocMemberResult.None ->
// Even if a symbol doesn't have a doc comment, it can still have generic parameters
computeGenericParametersText tooltipData, false
let docComment =
match computeGenericParametersText tooltipData with
| Some genericParametersText -> genericParametersText
| None -> ""

docComment, false
| TryGetXmlDocMemberResult.Error -> ERROR_WHILE_PARSING_DOC_COMMENT, false

{| DocComment = docComment
Expand Down

0 comments on commit f9cce33

Please sign in to comment.