Skip to content

Commit

Permalink
feat(lsp): Add hover for submodules (#2028)
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake authored Feb 22, 2024
1 parent 53a33e6 commit 85d8768
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/src/language_server/hover.re
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
20 changes: 20 additions & 0 deletions compiler/src/language_server/sourcetree.re
Original file line number Diff line number Diff line change
Expand Up @@ -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 :=
[
Expand Down

0 comments on commit 85d8768

Please sign in to comment.