Skip to content

Commit c8f1f1f

Browse files
committed
Handle mod type declarations.
1 parent ae33fbe commit c8f1f1f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

analysis/src/ProcessCmt.ml

+18-1
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,24 @@ let rec forItem ~env ~(exported : exported) item =
343343
mb_attributes exported.modules env.stamps.modules
344344
in
345345
[{declared with item = Module declared.item}]
346+
| Tstr_modtype
347+
{
348+
mtd_name = name;
349+
mtd_id;
350+
mtd_attributes;
351+
mtd_type = Some {mty_type = modType};
352+
mtd_loc;
353+
} ->
354+
let env =
355+
{env with modulePath = ExportedModule (name.txt, env.modulePath)}
356+
in
357+
let modTypeItem = forModuleType env modType in
358+
let declared =
359+
addItem ~item:modTypeItem ~name ~extent:mtd_loc
360+
~stamp:(Ident.binding_time mtd_id)
361+
~env mtd_attributes exported.modules env.stamps.modules
362+
in
363+
[{declared with item = Module modTypeItem}]
346364
| Tstr_include {incl_mod; incl_type} ->
347365
let env =
348366
match getModulePath incl_mod.mod_desc with
@@ -375,7 +393,6 @@ let rec forItem ~env ~(exported : exported) item =
375393
| _ -> Types.Trec_next
376394
in
377395
decl |> forTypeDeclaration ~env ~exported ~recStatus)
378-
| Tstr_modtype _ -> []
379396
| _ -> []
380397

381398
and forModule env mod_desc moduleName =

analysis/tests/src/expected/Hover.res.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Hover tests/src/Hover.res 44:10
2929
{"contents": "```rescript\nint\n```"}
3030

3131
Hover tests/src/Hover.res 47:13
32-
null
32+
{"contents": "```rescript\nmodule Logger = {\n let log: string => unit\n}\n```"}
3333

3434
Hover tests/src/Hover.res 52:7
3535
{"contents": "```rescript\nmodule JsLogger = {\n let log: string => unit\n let _oneMore: int\n}\n```"}

0 commit comments

Comments
 (0)