File tree 2 files changed +9
-2
lines changed
2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -502,7 +502,7 @@ let getComplementaryCompletionsForTypedValue ~opens ~allFiles ~scope ~env prefix
502
502
Utils. checkName name ~prefix ~exact
503
503
&& not
504
504
(* TODO complete the namespaced name too *)
505
- (String. contains name '-' )
505
+ (Utils. hasUnallowedChars name)
506
506
then
507
507
Some
508
508
(Completion. create name ~env ~kind: (Completion. FileModule name))
@@ -528,7 +528,7 @@ let getCompletionsForPath ~debug ~package ~opens ~full ~pos ~exact ~scope
528
528
Utils. checkName name ~prefix ~exact
529
529
&& not
530
530
(* TODO complete the namespaced name too *)
531
- (String. contains name '-' )
531
+ (Utils. hasUnallowedChars name)
532
532
then
533
533
Some
534
534
(Completion. create name ~env ~kind: (Completion. FileModule name))
Original file line number Diff line number Diff line change @@ -216,3 +216,10 @@ let rec lastElements list =
216
216
let lowercaseFirstChar s =
217
217
if String. length s = 0 then s
218
218
else String. mapi (fun i c -> if i = 0 then Char. lowercase_ascii c else c) s
219
+
220
+ let hasUnallowedChars s =
221
+ let regexp = Str. regexp " [^A-Za-z0-9]" in
222
+ try
223
+ ignore (Str. search_forward regexp s 0 );
224
+ true
225
+ with Not_found -> false
You can’t perform that action at this time.
0 commit comments