@@ -2173,27 +2173,14 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
2173
2173
Utils. startsWith name prefix
2174
2174
&& (forHover || not (List. mem name identsSeen )))
2175
2175
|> List. map mkLabel
2176
- | Cpattern {typ; prefix; nested = [] ; fallback} -> (
2177
- let envWhereCompletionStarted = env in
2178
- match
2179
- typ
2180
- |> getCompletionsForContextPath ~full ~opens ~rawOpens ~allFiles ~pos ~env
2181
- ~exact :true ~scope
2182
- |> completionsGetTypeEnv
2183
- with
2184
- | Some (typ , env ) -> (
2185
- let items =
2186
- typ
2187
- |> completeTypedValue ~env ~envWhereCompletionStarted ~full ~prefix
2188
- ~expandOption :false ~includeLocalValues :false
2189
- ~completionContext :None
2190
- in
2191
- match (items , fallback ) with
2192
- | [] , Some fallback ->
2193
- fallback |> processCompletable ~debug ~full ~scope ~env ~pos ~forHover
2194
- | items , _ -> items )
2195
- | None -> [] )
2196
2176
| Cpattern {typ; prefix; nested; fallback} -> (
2177
+ let fallbackOrEmpty ?items () =
2178
+ match (fallback , items ) with
2179
+ | Some fallback , (None | Some [] ) ->
2180
+ fallback |> processCompletable ~debug ~full ~scope ~env ~pos ~forHover
2181
+ | _ , Some items -> items
2182
+ | None, None -> []
2183
+ in
2197
2184
let envWhereCompletionStarted = env in
2198
2185
match
2199
2186
typ
@@ -2203,15 +2190,12 @@ Note: The `@react.component` decorator requires the react-jsx config to be set i
2203
2190
with
2204
2191
| Some (typ , env ) -> (
2205
2192
match typ |> resolveNestedPattern ~env ~package :full .package ~nested with
2206
- | None -> []
2207
- | Some (typ , env , completionContext ) -> (
2193
+ | None -> fallbackOrEmpty ()
2194
+ | Some (typ , env , completionContext ) ->
2208
2195
let items =
2209
2196
typ
2210
2197
|> completeTypedValue ~env ~envWhereCompletionStarted ~full ~prefix
2211
2198
~expandOption :false ~includeLocalValues :false ~completionContext
2212
2199
in
2213
- match (items , fallback ) with
2214
- | [] , Some fallback ->
2215
- fallback |> processCompletable ~debug ~full ~scope ~env ~pos ~forHover
2216
- | items , _ -> items ))
2217
- | None -> [] )
2200
+ fallbackOrEmpty ~items () )
2201
+ | None -> fallbackOrEmpty () )
0 commit comments