@@ -777,11 +777,10 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
777
777
in
778
778
let value_binding (iterator : Ast_iterator.iterator )
779
779
(value_binding : Parsetree.value_binding ) =
780
- if
781
- locHasCursor value_binding.pvb_expr.pexp_loc
782
- && Utils. isReactComponent value_binding
783
- then inJsxContext := true ;
784
- Ast_iterator. default_iterator.value_binding iterator value_binding
780
+ let oldInJsxContext = ! inJsxContext in
781
+ if Utils. isReactComponent value_binding then inJsxContext := true ;
782
+ Ast_iterator. default_iterator.value_binding iterator value_binding;
783
+ inJsxContext := oldInJsxContext
785
784
in
786
785
let signature (iterator : Ast_iterator .iterator )
787
786
(signature : Parsetree .signature ) =
@@ -859,6 +858,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
859
858
Ast_iterator. default_iterator.attribute iterator (id, payload)
860
859
in
861
860
let expr (iterator : Ast_iterator.iterator ) (expr : Parsetree.expression ) =
861
+ let oldInJsxContext = ! inJsxContext in
862
862
let processed = ref false in
863
863
let setFound () =
864
864
found := true ;
@@ -1115,6 +1115,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
1115
1115
processed := true
1116
1116
| _ -> () );
1117
1117
if not ! processed then Ast_iterator. default_iterator.expr iterator expr
1118
+ else inJsxContext := oldInJsxContext
1118
1119
in
1119
1120
let typ (iterator : Ast_iterator .iterator ) (core_type : Parsetree .core_type ) =
1120
1121
if core_type .ptyp_loc |> Loc .hasPos ~pos: posNoWhite then (
0 commit comments