Skip to content

Commit 0fb01e1

Browse files
committed
Fix doc display
1 parent da0379b commit 0fb01e1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ghcide/src/Development/IDE/Plugin/Completions/Logic.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ mkCompl
204204
where kind = Just compKind
205205
docs' = imported : spanDocToMarkdown docs
206206
imported = case provenance of
207-
Local pos -> "*Defined at " <> pprLineCol (srcSpanStart pos) <> " in this module*\n'"
207+
Local pos -> "*Defined at " <> pprLineCol (srcSpanStart pos) <> " in this module*\n"
208208
ImportedFrom mod -> "*Imported from '" <> mod <> "'*\n"
209209
DefinedIn mod -> "*Defined in '" <> mod <> "'*\n"
210210
colon = if optNewColonConvention then ": " else ":: "

ghcide/src/Development/IDE/Spans/Common.hs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ safeTyThingId _ = Nothing
6262
-- Possible documentation for an element in the code
6363
data SpanDoc
6464
= SpanDocString HsDocString SpanDocUris
65+
-- ^ Extern module doc
6566
| SpanDocText [T.Text] SpanDocUris
67+
-- ^ Local module doc
6668
deriving stock (Eq, Show, Generic)
6769
deriving anyclass NFData
6870

@@ -78,11 +80,11 @@ emptySpanDoc = SpanDocText [] (SpanDocUris Nothing Nothing)
7880

7981
spanDocToMarkdown :: SpanDoc -> [T.Text]
8082
spanDocToMarkdown (SpanDocString docs uris)
81-
= [T.pack $ haddockToMarkdown $ H.toRegular $ H._doc $ H.parseParas Nothing $ unpackHDS docs]
82-
<> ["\n"] <> spanDocUrisToMarkdown uris
83+
= [(T.pack $ haddockToMarkdown $ H.toRegular $ H._doc $ H.parseParas Nothing $ unpackHDS docs) <> T.pack "\n"]
84+
<> spanDocUrisToMarkdown uris
8385
-- Append the extra newlines since this is markdown --- to get a visible newline,
8486
-- you need to have two newlines
85-
spanDocToMarkdown (SpanDocText txt uris) = txt <> ["\n"] <> spanDocUrisToMarkdown uris
87+
spanDocToMarkdown (SpanDocText txt uris) = map (<> T.pack "\n") txt <> ["\n"] <> spanDocUrisToMarkdown uris
8688

8789
spanDocUrisToMarkdown :: SpanDocUris -> [T.Text]
8890
spanDocUrisToMarkdown (SpanDocUris mdoc msrc) = catMaybes

0 commit comments

Comments
 (0)