Skip to content

Commit 65c25b0

Browse files
authored
remove formatCode function (#836)
1 parent 6c305cc commit 65c25b0

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

analysis/src/DocExtraction.ml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@ and docsForModule = {
4848
items: docItem list;
4949
}
5050

51-
let formatCode content =
52-
let {Res_driver.parsetree = signature; comments} =
53-
Res_driver.parseInterfaceFromSource ~forPrinter:true
54-
~displayFilename:"<missing-file>" ~source:content
55-
in
56-
Res_printer.printInterface ~width:!Res_cli.ResClflags.width ~comments
57-
signature
58-
|> String.trim
59-
6051
let stringifyDocstrings docstrings =
6152
let open Protocol in
6253
docstrings
@@ -282,8 +273,7 @@ let extractDocs ~path ~debug =
282273
id = modulePath |> makeId ~identifier:item.name;
283274
docstring = item.docstring |> List.map String.trim;
284275
signature =
285-
"let " ^ item.name ^ ": " ^ Shared.typeToString typ
286-
|> formatCode;
276+
"let " ^ item.name ^ ": " ^ Shared.typeToString typ;
287277
name = item.name;
288278
deprecated = item.deprecated;
289279
})
@@ -293,10 +283,7 @@ let extractDocs ~path ~debug =
293283
{
294284
id = modulePath |> makeId ~identifier:item.name;
295285
docstring = item.docstring |> List.map String.trim;
296-
signature =
297-
typ.decl
298-
|> Shared.declToString item.name
299-
|> formatCode;
286+
signature = typ.decl |> Shared.declToString item.name;
300287
name = item.name;
301288
deprecated = item.deprecated;
302289
detail = typeDetail typ ~full ~env;

analysis/tests/src/expected/DocExtractionRes.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extracting docs for src/DocExtractionRes.res
118118
"id": "DocExtractionRes.AnotherModule.someVariantWithInlineRecords",
119119
"kind": "type",
120120
"name": "someVariantWithInlineRecords",
121-
"signature": "type someVariantWithInlineRecords = SomeStuff({offline: bool})",
121+
"signature": "type someVariantWithInlineRecords =\\n | SomeStuff({offline: bool})",
122122
"docstrings": ["Trying how it looks with an inline record in a variant."],
123123
"detail":
124124
{

0 commit comments

Comments
 (0)