Skip to content

Commit 089ee0f

Browse files
authored
fix(tools): get docstrings from module file (#878)
* get docstrings from module file * update tests * [skip ci]: update CHANGELOG.md * get both docstrings
1 parent f41521e commit 089ee0f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

analysis/src/DocExtraction.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -294,25 +294,25 @@ let extractDocs ~path ~debug =
294294
let id =
295295
(modulePath |> List.rev |> List.hd) ^ "." ^ item.name
296296
in
297-
let items =
297+
let items, internalDocstrings =
298298
match
299299
ProcessCmt.fileForModule ~package:full.package
300300
aliasToModule
301301
with
302-
| None -> []
302+
| None -> ([], [])
303303
| Some file ->
304304
let docs =
305305
extractDocsForModule ~modulePath:[id] file.structure
306306
in
307-
docs.items
307+
(docs.items, docs.docstring)
308308
in
309309
Some
310310
(ModuleAlias
311311
{
312312
id;
313313
name = item.name;
314314
items;
315-
docstring = item.docstring |> List.map String.trim;
315+
docstring = item.docstring @ internalDocstrings |> List.map String.trim;
316316
})
317317
| Module (Structure m) ->
318318
(* module Whatever = {} in res or module Whatever: {} in resi. *)

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+
- Fix docstrings for module alias. Get internal docstrings of module file. https://github.com/rescript-lang/rescript-vscode/pull/878
18+
1519
## 0.3.0
1620

1721
#### :rocket: New Feature

0 commit comments

Comments
 (0)