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 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 + } + }] }] }