File tree 3 files changed +25
-6
lines changed
3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -1136,14 +1136,9 @@ and getCompletionsForContextPath ~debug ~full ~opens ~rawOpens ~pos ~env ~exact
1136
1136
else true )
1137
1137
in
1138
1138
1139
- (* TODO(config-complete-builtins) This config and config resolution should come from `package` instead. *)
1140
- let pretendPackageBuiltinsConfig =
1141
- Misc.StringMap. of_list
1142
- [(" array" , [" ArrayUtils" ]); (" Fastify.t" , [" FastifyExt" ])]
1143
- in
1144
1139
let globallyConfiguredCompletionsForType =
1145
1140
match
1146
- pretendPackageBuiltinsConfig |> Misc.StringMap. find_opt mainTypeId
1141
+ package.autocompleteConfig |> Misc.StringMap. find_opt mainTypeId
1147
1142
with
1148
1143
| None -> []
1149
1144
| Some completionPaths ->
Original file line number Diff line number Diff line change @@ -66,6 +66,28 @@ let newBsPackage ~rootPath =
66
66
| _ -> None )
67
67
| None -> None
68
68
in
69
+ let autocompleteConfig =
70
+ match config |> Json. get " editor" with
71
+ | Some editorConfig -> (
72
+ match editorConfig |> Json. get " autocompleteConfig" with
73
+ | Some (Object map ) ->
74
+ map
75
+ |> List. fold_left
76
+ (fun acc (key , value ) ->
77
+ match value with
78
+ | Json. Array items ->
79
+ let values =
80
+ items
81
+ |> List. filter_map (function
82
+ | Json. String s -> Some s
83
+ | _ -> None )
84
+ in
85
+ Misc.StringMap. add key values acc
86
+ | _ -> acc)
87
+ Misc.StringMap. empty
88
+ | _ -> Misc.StringMap. empty)
89
+ | None -> Misc.StringMap. empty
90
+ in
69
91
let uncurried = uncurried = Some true in
70
92
match libBs with
71
93
| None -> None
@@ -158,6 +180,7 @@ let newBsPackage ~rootPath =
158
180
opens;
159
181
namespace;
160
182
uncurried;
183
+ autocompleteConfig;
161
184
}))
162
185
| None -> None
163
186
in
Original file line number Diff line number Diff line change @@ -494,6 +494,7 @@ type package = {
494
494
opens : path list ;
495
495
uncurried : bool ;
496
496
rescriptVersion : int * int ;
497
+ autocompleteConfig : file list Misc.StringMap .t ;
497
498
}
498
499
499
500
let allFilesInPackage package =
You can’t perform that action at this time.
0 commit comments