diff --git a/compiler/src/language_server/hover.re b/compiler/src/language_server/hover.re index b1dcf47552..a94126a45f 100644 --- a/compiler/src/language_server/hover.re +++ b/compiler/src/language_server/hover.re @@ -182,7 +182,7 @@ let process = ~range=Utils.loc_to_range(loc), exception_declaration_lens(ident, ext), ) - | [Module({path, decl, loc}), ..._] => + | [Module({decl, loc}), ..._] => send_hover(~id, ~range=Utils.loc_to_range(loc), module_lens(decl)) | [Include({env, path, loc}), ..._] => send_hover( diff --git a/compiler/src/language_server/sourcetree.re b/compiler/src/language_server/sourcetree.re index f07e378dcf..408f6104e2 100644 --- a/compiler/src/language_server/sourcetree.re +++ b/compiler/src/language_server/sourcetree.re @@ -509,6 +509,26 @@ module Sourcetree: Sourcetree = { }; let enter_toplevel_stmt = stmt => { switch (stmt.ttop_desc) { + | TTopModule(decl) => + let path = Path.PIdent(decl.tmod_id); + try({ + let mod_decl = Env.find_module(path, None, stmt.ttop_env); + segments := + [ + ( + loc_to_interval(stmt.ttop_loc), + Module({ + path, + decl: mod_decl, + loc: stmt.ttop_loc, + definition: None, + }), + ), + ...segments^, + ]; + }) { + | Not_found => () + }; | TTopInclude(inc) => segments := [