Skip to content

Commit

Permalink
[easy] switch Autocomplete_js.Acjsx to record argument
Browse files Browse the repository at this point in the history
Summary: record > big tuple

Reviewed By: mroch

Differential Revision: D25593035

fbshipit-source-id: 6808bb2ee8d42d3122a260380613234f3a2f3503
  • Loading branch information
Vijay Ramamurthy authored and facebook-github-bot committed Dec 17, 2020
1 parent 38d2dcd commit 27142d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/services/autocomplete/autocompleteService_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,18 @@ let autocomplete_get_results ~options ~reader ~cx ~file_sig ~ast ~typed_ast trig
in_optional_chain
ac_loc
~tparams )
| Some (tparams, ac_loc, Acjsx (ac_name, used_attr_names, cls)) ->
| Some (tparams, ac_loc, Acjsx { attribute_name; used_attr_names; component_t }) ->
( "Acjsx",
autocomplete_jsx ~reader cx file_sig typed_ast cls ac_name ~used_attr_names ac_loc ~tparams )
autocomplete_jsx
~reader
cx
file_sig
typed_ast
component_t
attribute_name
~used_attr_names
ac_loc
~tparams )
| Some (tparams, ac_loc, Actype { token }) ->
( "Actype",
autocomplete_unqualified_type
Expand Down
8 changes: 6 additions & 2 deletions src/services/autocomplete/autocomplete_js.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ type autocomplete_type =
in_optional_chain: bool;
}
(* JSX attributes *)
| Acjsx of string * SSet.t * Type.t
| Acjsx of {
attribute_name: string;
used_attr_names: SSet.t;
component_t: Type.t;
}
(* JSX text child *)
| Acjsxtext

Expand Down Expand Up @@ -176,7 +180,7 @@ class process_request_searcher (from_trigger_character : bool) (cursor : Loc.t)
in
Base.Option.iter
~f:(fun (attribute_name, loc, component_t) ->
this#find loc (Acjsx (attribute_name, used_attr_names, component_t)))
this#find loc (Acjsx { attribute_name; used_attr_names; component_t }))
found;
super#jsx_opening_element elt

Expand Down

0 comments on commit 27142d1

Please sign in to comment.