Skip to content

Commit 3f96e55

Browse files
committed
more sustainable fix, that also covers completions for all stdlib modules
1 parent 75a77be commit 3f96e55

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

analysis/src/TypeUtils.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1265,4 +1265,9 @@ let completionPathFromMaybeBuiltin path =
12651265
| Some ("result", _) -> Some ["Stdlib"; "Result"]
12661266
| Some ("dict", _) -> Some ["Stdlib"; "Dict"]
12671267
| Some ("char", _) -> Some ["Stdlib"; "Char"]
1268-
| _ -> None
1268+
| _ -> (
1269+
match path |> Utils.expandPath |> List.rev with
1270+
| [mainModule; "t"] when String.starts_with ~prefix:"Stdlib_" mainModule ->
1271+
(* Route Stdlib_X to Stdlib.X for proper completions without the Stdlib_ prefix *)
1272+
Some (String.split_on_char '_' mainModule)
1273+
| _ -> None)

compiler/frontend/ast_literal.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module Lid = struct
7171
let js_null_undefined : t = Ldot (Lident "Js", "null_undefined")
7272

7373
(* FIXME: Use primitive module *)
74-
let js_re_id : t = Ldot (Lident "RegExp", "t")
74+
let js_re_id : t = Ldot (Lident "Stdlib_RegExp", "t")
7575
end
7676

7777
module No_loc = struct

tests/analysis_tests/tests/src/expected/CompletionRegexp.res.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Resolved opens 1 Stdlib
66
ContextPath Value[emailPattern]->
77
ContextPath Value[emailPattern]
88
Path emailPattern
9-
CPPipe pathFromEnv:Stdlib.RegExp found:false
109
Path Stdlib.RegExp.
1110
[{
1211
"label": "RegExp.lastIndex",

0 commit comments

Comments
 (0)