From 52f2fbbc9e24925e760412bfe22398959275d959 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sat, 21 Oct 2023 00:59:57 -0300 Subject: [PATCH] remove formatCode function --- analysis/src/DocExtraction.ml | 17 ++--------------- .../tests/src/expected/DocExtractionRes.res.txt | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/analysis/src/DocExtraction.ml b/analysis/src/DocExtraction.ml index e1ca613bc..26f338186 100644 --- a/analysis/src/DocExtraction.ml +++ b/analysis/src/DocExtraction.ml @@ -48,15 +48,6 @@ and docsForModule = { items: docItem list; } -let formatCode content = - let {Res_driver.parsetree = signature; comments} = - Res_driver.parseInterfaceFromSource ~forPrinter:true - ~displayFilename:"" ~source:content - in - Res_printer.printInterface ~width:!Res_cli.ResClflags.width ~comments - signature - |> String.trim - let stringifyDocstrings docstrings = let open Protocol in docstrings @@ -282,8 +273,7 @@ let extractDocs ~path ~debug = id = modulePath |> makeId ~identifier:item.name; docstring = item.docstring |> List.map String.trim; signature = - "let " ^ item.name ^ ": " ^ Shared.typeToString typ - |> formatCode; + "let " ^ item.name ^ ": " ^ Shared.typeToString typ; name = item.name; deprecated = item.deprecated; }) @@ -293,10 +283,7 @@ let extractDocs ~path ~debug = { id = modulePath |> makeId ~identifier:item.name; docstring = item.docstring |> List.map String.trim; - signature = - typ.decl - |> Shared.declToString item.name - |> formatCode; + signature = typ.decl |> Shared.declToString item.name; name = item.name; deprecated = item.deprecated; detail = typeDetail typ ~full ~env; diff --git a/analysis/tests/src/expected/DocExtractionRes.res.txt b/analysis/tests/src/expected/DocExtractionRes.res.txt index b591bfd91..29e35a1e3 100644 --- a/analysis/tests/src/expected/DocExtractionRes.res.txt +++ b/analysis/tests/src/expected/DocExtractionRes.res.txt @@ -118,7 +118,7 @@ extracting docs for src/DocExtractionRes.res "id": "DocExtractionRes.AnotherModule.someVariantWithInlineRecords", "kind": "type", "name": "someVariantWithInlineRecords", - "signature": "type someVariantWithInlineRecords = SomeStuff({offline: bool})", + "signature": "type someVariantWithInlineRecords =\\n | SomeStuff({offline: bool})", "docstrings": ["Trying how it looks with an inline record in a variant."], "detail": {