Skip to content

Commit 35c2aef

Browse files
zthcristianoc
authored andcommitted
fix
1 parent db987f4 commit 35c2aef

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -736,14 +736,14 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
736736
|> getCompletionsForPath ~package ~opens ~allFiles ~pos ~exact
737737
~completionContext ~env ~scope
738738
| CPApply (cp, labels) -> (
739-
(* TODO: Also needs to support ExtractedType *)
740739
match
741740
cp
742741
|> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
743742
~exact:true ~scope
744-
|> completionsGetTypeEnv2 ~full ~opens ~rawOpens ~allFiles ~pos ~scope
743+
|> completionsGetCompletionType2 ~full ~opens ~rawOpens ~allFiles ~pos
744+
~scope
745745
with
746-
| Some (typ, env) -> (
746+
| Some ((TypeExpr typ | ExtractedType (Tfunction {typ})), env) -> (
747747
let rec reconstructFunctionType args tRet =
748748
match args with
749749
| [] -> tRet
@@ -776,7 +776,7 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
776776
let retType = reconstructFunctionType args tRet in
777777
[Completion.create "dummy" ~env ~kind:(Completion.Value retType)]
778778
| _ -> [])
779-
| None -> [])
779+
| _ -> [])
780780
| CPField (CPId (path, Module), fieldName) ->
781781
(* M.field *)
782782
path @ [fieldName]
@@ -1048,16 +1048,17 @@ and getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
10481048
~kind:(Completion.Value (Utils.unwrapIfOption typ));
10491049
])
10501050
| CArgument {functionContextPath; argumentLabel} -> (
1051-
(* TODO: Also needs to support ExtractedType *)
10521051
let labels, env =
10531052
match
10541053
functionContextPath
10551054
|> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos
10561055
~env ~exact:true ~scope
1057-
|> completionsGetTypeEnv2 ~full ~opens ~rawOpens ~allFiles ~pos ~scope
1056+
|> completionsGetCompletionType2 ~full ~opens ~rawOpens ~allFiles ~pos
1057+
~scope
10581058
with
1059-
| Some (typ, env) -> (typ |> TypeUtils.getArgs ~full ~env, env)
1060-
| None -> ([], env)
1059+
| Some ((TypeExpr typ | ExtractedType (Tfunction {typ})), env) ->
1060+
(typ |> TypeUtils.getArgs ~full ~env, env)
1061+
| _ -> ([], env)
10611062
in
10621063
let targetLabel =
10631064
labels

0 commit comments

Comments
 (0)