Skip to content

Commit aaed47a

Browse files
committed
use env where completion started to populate values and module completions
1 parent fd5c019 commit aaed47a

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

analysis/src/CompletionBackEnd.ml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,8 @@ let rec extractType ~env ~package (t : Types.type_expr) =
15021502
| Ttuple expressions -> Some (Tuple (env, expressions))
15031503
| _ -> None
15041504

1505-
let completeTypedValue ~env ~full ~prefix ~expandOption =
1505+
let completeTypedValue ~env ~envWhereCompletionStarted ~full ~prefix
1506+
~expandOption =
15061507
let namesUsed = Hashtbl.create 10 in
15071508
let rec completeTypedValueInner t ~env ~full ~prefix ~expandOption =
15081509
let items =
@@ -1575,8 +1576,10 @@ let completeTypedValue ~env ~full ~prefix ~expandOption =
15751576
if prefix = "" then items
15761577
else
15771578
items
1578-
@ completionForExportedValues ~env ~prefix ~exact:false ~namesUsed
1579-
@ completionForExportedModules ~env ~prefix ~exact:false ~namesUsed
1579+
@ completionForExportedValues ~env:envWhereCompletionStarted ~prefix
1580+
~exact:false ~namesUsed
1581+
@ completionForExportedModules ~env:envWhereCompletionStarted ~prefix
1582+
~exact:false ~namesUsed
15801583
in
15811584
completeTypedValueInner ~env ~full ~prefix ~expandOption
15821585

@@ -1943,6 +1946,7 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
19431946
(dec2, doc))
19441947
|> List.map mkDecorator
19451948
| Cargument {functionContextPath; argumentLabel; prefix} -> (
1949+
let envWhereCompletionStarted = env in
19461950
let labels =
19471951
match
19481952
functionContextPath
@@ -1959,9 +1963,13 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
19591963
match targetLabel with
19601964
| None -> []
19611965
| Some (Labelled _, typ) ->
1962-
typ |> completeTypedValue ~env ~full ~prefix ~expandOption:true
1966+
typ
1967+
|> completeTypedValue ~env ~envWhereCompletionStarted ~full ~prefix
1968+
~expandOption:true
19631969
| Some (Unlabelled _, typ) ->
1964-
typ |> completeTypedValue ~env ~full ~prefix ~expandOption:false)
1970+
typ
1971+
|> completeTypedValue ~env ~envWhereCompletionStarted ~full ~prefix
1972+
~expandOption:false)
19651973
| CnamedArg (cp, prefix, identsSeen) ->
19661974
let labels =
19671975
match

0 commit comments

Comments
 (0)