Skip to content

Commit

Permalink
Clean up hover of namespaced module (#845)
Browse files Browse the repository at this point in the history
* clean up hover of namespaced module

* changelog
  • Loading branch information
zth authored Nov 12, 2023
1 parent 6ea3d1c commit f093f87
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#### :bug: Bug Fix

- Clean up name of namespaced module when hovering. https://github.com/rescript-lang/rescript-vscode/pull/845
- Fix issue `open` on submodules exposed via `-open` in bsconfig.json/rescript.json, that would cause the content of those `open` modules to not actually appear in autocomplete. https://github.com/rescript-lang/rescript-vscode/pull/842
- Account for namespace when filtering pipe completion items. https://github.com/rescript-lang/rescript-vscode/pull/843

Expand Down
1 change: 1 addition & 0 deletions analysis/src/Hover.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let showModuleTopLevel ~docstring ~isType ~name (topLevel : Module.item list) =
(* TODO indent *)
|> String.concat "\n"
in
let name = Utils.cutAfterDash name in
let full =
Markdown.codeBlock
("module "
Expand Down
5 changes: 5 additions & 0 deletions analysis/src/Utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,8 @@ let rec lastElements list =
let lowercaseFirstChar s =
if String.length s = 0 then s
else String.mapi (fun i c -> if i = 0 then Char.lowercase_ascii c else c) s

let cutAfterDash s =
match String.index s '-' with
| n -> ( try String.sub s 0 n with Invalid_argument _ -> s)
| exception Not_found -> s

0 comments on commit f093f87

Please sign in to comment.