From 47e01ba9bc8b269b53fd0f692d484a8a620fb0a0 Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sun, 9 Jun 2024 17:45:25 -0300 Subject: [PATCH 1/2] print module structure with signature to module path --- tools/src/tools.ml | 6 ++++ .../src/expected/DocExtractionRes.res.json | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/tools/src/tools.ml b/tools/src/tools.ml index b2a9fd742..9a314f92d 100644 --- a/tools/src/tools.ml +++ b/tools/src/tools.ml @@ -469,6 +469,12 @@ let extractDocs ~entryPointFile ~debug = (extractDocsForModule ~modulePath:(interface.name :: modulePath) interface)) + | Module {type_ = Constraint (Structure m, Ident _)} -> + (* module M: T = { }. Print M *) + Some + (Module + (extractDocsForModule + ~modulePath:(m.name :: modulePath) m)) | _ -> None); } in diff --git a/tools/tests/src/expected/DocExtractionRes.res.json b/tools/tests/src/expected/DocExtractionRes.res.json index 3ea8b7eb8..5f46f92db 100644 --- a/tools/tests/src/expected/DocExtractionRes.res.json +++ b/tools/tests/src/expected/DocExtractionRes.res.json @@ -306,5 +306,41 @@ "col": 3 } }] + }, + { + "id": "DocExtractionRes.M", + "name": "M", + "kind": "module", + "docstrings": ["implementation of Example module type"], + "source": { + "filepath": "src/DocExtractionRes.res", + "line": 1, + "col": 1 + }, + "items": [ + { + "id": "DocExtractionRes.M.t", + "kind": "type", + "name": "t", + "signature": "type t = int", + "docstrings": ["main type"], + "source": { + "filepath": "src/DocExtractionRes.res", + "line": 123, + "col": 3 + } + }, + { + "id": "DocExtractionRes.M.f", + "kind": "value", + "name": "f", + "signature": "let f: int => int", + "docstrings": ["identity function"], + "source": { + "filepath": "src/DocExtractionRes.res", + "line": 128, + "col": 7 + } + }] }] } From 5d11d71555a9b4f69b5abfbc95392828225cc5cf Mon Sep 17 00:00:00 2001 From: Pedro Castro Date: Sun, 9 Jun 2024 18:03:00 -0300 Subject: [PATCH 2/2] update CHANGELOG.md --- tools/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/CHANGELOG.md b/tools/CHANGELOG.md index 394d4e421..184e006d8 100644 --- a/tools/CHANGELOG.md +++ b/tools/CHANGELOG.md @@ -12,6 +12,10 @@ ## master +### :bug: Bug Fix + +- Print module structure with signature to module path. https://github.com/rescript-lang/rescript-vscode/pull/1018 + ## 0.6.3 #### :bug: Bug Fix