Skip to content

Dont complete for illegal file module names #844

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
better name
  • Loading branch information
zth committed Nov 13, 2023
commit 7619c0cf76b5644863d49787e766d7f96baf46e7
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 *)
(Utils.hasUnallowedChars 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 *)
(Utils.hasUnallowedChars name)
(Utils.fileNameHasUnallowedChars name)
then
Some
(Completion.create name ~env ~kind:(Completion.FileModule name))
Expand Down
2 changes: 1 addition & 1 deletion analysis/src/Utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ let cutAfterDash s =
| n -> ( try String.sub s 0 n with Invalid_argument _ -> s)
| exception Not_found -> s

let hasUnallowedChars s =
let fileNameHasUnallowedChars s =
let regexp = Str.regexp "[^A-Za-z0-9]" in
try
ignore (Str.search_forward regexp s 0);
Expand Down