Skip to content

Commit f093f87

Browse files
authored
Clean up hover of namespaced module (#845)
* clean up hover of namespaced module * changelog
1 parent 6ea3d1c commit f093f87

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#### :bug: Bug Fix
1616

17+
- Clean up name of namespaced module when hovering. https://github.com/rescript-lang/rescript-vscode/pull/845
1718
- 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
1819
- Account for namespace when filtering pipe completion items. https://github.com/rescript-lang/rescript-vscode/pull/843
1920

analysis/src/Hover.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ let showModuleTopLevel ~docstring ~isType ~name (topLevel : Module.item list) =
1414
(* TODO indent *)
1515
|> String.concat "\n"
1616
in
17+
let name = Utils.cutAfterDash name in
1718
let full =
1819
Markdown.codeBlock
1920
("module "

analysis/src/Utils.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,8 @@ let rec lastElements list =
216216
let lowercaseFirstChar s =
217217
if String.length s = 0 then s
218218
else String.mapi (fun i c -> if i = 0 then Char.lowercase_ascii c else c) s
219+
220+
let cutAfterDash s =
221+
match String.index s '-' with
222+
| n -> ( try String.sub s 0 n with Invalid_argument _ -> s)
223+
| exception Not_found -> s

0 commit comments

Comments
 (0)