Skip to content

Commit 96f3883

Browse files
authored
Tools: Print module structure with signature to module path (#1018)
* print module structure with signature to module path * update CHANGELOG.md
1 parent 27287fd commit 96f3883

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

tools/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
1313
## master
1414

15+
### :bug: Bug Fix
16+
17+
- Print module structure with signature to module path. https://github.com/rescript-lang/rescript-vscode/pull/1018
18+
1519
## 0.6.3
1620

1721
#### :bug: Bug Fix

tools/src/tools.ml

+6
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,12 @@ let extractDocs ~entryPointFile ~debug =
469469
(extractDocsForModule
470470
~modulePath:(interface.name :: modulePath)
471471
interface))
472+
| Module {type_ = Constraint (Structure m, Ident _)} ->
473+
(* module M: T = { }. Print M *)
474+
Some
475+
(Module
476+
(extractDocsForModule
477+
~modulePath:(m.name :: modulePath) m))
472478
| _ -> None);
473479
}
474480
in

tools/tests/src/expected/DocExtractionRes.res.json

+36
Original file line numberDiff line numberDiff line change
@@ -306,5 +306,41 @@
306306
"col": 3
307307
}
308308
}]
309+
},
310+
{
311+
"id": "DocExtractionRes.M",
312+
"name": "M",
313+
"kind": "module",
314+
"docstrings": ["implementation of Example module type"],
315+
"source": {
316+
"filepath": "src/DocExtractionRes.res",
317+
"line": 1,
318+
"col": 1
319+
},
320+
"items": [
321+
{
322+
"id": "DocExtractionRes.M.t",
323+
"kind": "type",
324+
"name": "t",
325+
"signature": "type t = int",
326+
"docstrings": ["main type"],
327+
"source": {
328+
"filepath": "src/DocExtractionRes.res",
329+
"line": 123,
330+
"col": 3
331+
}
332+
},
333+
{
334+
"id": "DocExtractionRes.M.f",
335+
"kind": "value",
336+
"name": "f",
337+
"signature": "let f: int => int",
338+
"docstrings": ["identity function"],
339+
"source": {
340+
"filepath": "src/DocExtractionRes.res",
341+
"line": 128,
342+
"col": 7
343+
}
344+
}]
309345
}]
310346
}

0 commit comments

Comments
 (0)