Skip to content

Commit 85d8768

Browse files
authored
feat(lsp): Add hover for submodules (#2028)
1 parent 53a33e6 commit 85d8768

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

compiler/src/language_server/hover.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ let process =
182182
~range=Utils.loc_to_range(loc),
183183
exception_declaration_lens(ident, ext),
184184
)
185-
| [Module({path, decl, loc}), ..._] =>
185+
| [Module({decl, loc}), ..._] =>
186186
send_hover(~id, ~range=Utils.loc_to_range(loc), module_lens(decl))
187187
| [Include({env, path, loc}), ..._] =>
188188
send_hover(

compiler/src/language_server/sourcetree.re

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,26 @@ module Sourcetree: Sourcetree = {
509509
};
510510
let enter_toplevel_stmt = stmt => {
511511
switch (stmt.ttop_desc) {
512+
| TTopModule(decl) =>
513+
let path = Path.PIdent(decl.tmod_id);
514+
try({
515+
let mod_decl = Env.find_module(path, None, stmt.ttop_env);
516+
segments :=
517+
[
518+
(
519+
loc_to_interval(stmt.ttop_loc),
520+
Module({
521+
path,
522+
decl: mod_decl,
523+
loc: stmt.ttop_loc,
524+
definition: None,
525+
}),
526+
),
527+
...segments^,
528+
];
529+
}) {
530+
| Not_found => ()
531+
};
512532
| TTopInclude(inc) =>
513533
segments :=
514534
[

0 commit comments

Comments
 (0)