Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#### :bug: Bug Fix

- Clean up name of namespaced module when hovering. https://github.com/rescript-lang/rescript-vscode/pull/845
- Don't complete illegal file module names. https://github.com/rescript-lang/rescript-vscode/pull/844
- 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
4 changes: 2 additions & 2 deletions analysis/src/CompletionBackEnd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ let getComplementaryCompletionsForTypedValue ~opens ~allFiles ~scope ~env prefix
Utils.checkName name ~prefix ~exact
&& not
(* TODO complete the namespaced name too *)
(String.contains name '-')
(Utils.fileNameHasUnallowedChars name)
then
Some
(Completion.create name ~env ~kind:(Completion.FileModule name))
Expand All @@ -528,7 +528,7 @@ let getCompletionsForPath ~debug ~package ~opens ~full ~pos ~exact ~scope
Utils.checkName name ~prefix ~exact
&& not
(* TODO complete the namespaced name too *)
(String.contains name '-')
(Utils.fileNameHasUnallowedChars name)
then
Some
(Completion.create name ~env ~kind:(Completion.FileModule name))
Expand Down
7 changes: 7 additions & 0 deletions analysis/src/Utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,10 @@ let cutAfterDash s =
match String.index s '-' with
| n -> ( try String.sub s 0 n with Invalid_argument _ -> s)
| exception Not_found -> s

let fileNameHasUnallowedChars s =
let regexp = Str.regexp "[^A-Za-z0-9]" in
try
ignore (Str.search_forward regexp s 0);
true
with Not_found -> false