Skip to content

Commit

Permalink
Tools: Print module structure with signature to module path (#1018)
Browse files Browse the repository at this point in the history
* print module structure with signature to module path

* update CHANGELOG.md
  • Loading branch information
aspeddro authored Jun 10, 2024
1 parent 27287fd commit 96f3883
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tools/src/tools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions tools/tests/src/expected/DocExtractionRes.res.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}]
}]
}

0 comments on commit 96f3883

Please sign in to comment.