@@ -1038,11 +1038,10 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
1038
1038
in
1039
1039
let value_binding (iterator : Ast_iterator.iterator )
1040
1040
(value_binding : Parsetree.value_binding ) =
1041
- if
1042
- locHasCursor value_binding.pvb_expr.pexp_loc
1043
- && Utils. isReactComponent value_binding
1044
- then inJsxContext := true ;
1045
- Ast_iterator. default_iterator.value_binding iterator value_binding
1041
+ let oldInJsxContext = ! inJsxContext in
1042
+ if Utils. isReactComponent value_binding then inJsxContext := true ;
1043
+ Ast_iterator. default_iterator.value_binding iterator value_binding;
1044
+ inJsxContext := oldInJsxContext
1046
1045
in
1047
1046
let signature (iterator : Ast_iterator .iterator )
1048
1047
(signature : Parsetree .signature ) =
@@ -1120,6 +1119,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
1120
1119
Ast_iterator. default_iterator.attribute iterator (id, payload)
1121
1120
in
1122
1121
let expr (iterator : Ast_iterator.iterator ) (expr : Parsetree.expression ) =
1122
+ let oldInJsxContext = ! inJsxContext in
1123
1123
let processed = ref false in
1124
1124
let setFound () =
1125
1125
found := true ;
@@ -1379,6 +1379,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
1379
1379
processed := true
1380
1380
| _ -> () );
1381
1381
if not ! processed then Ast_iterator. default_iterator.expr iterator expr
1382
+ else inJsxContext := oldInJsxContext
1382
1383
in
1383
1384
let typ (iterator : Ast_iterator .iterator ) (core_type : Parsetree .core_type ) =
1384
1385
if core_type .ptyp_loc |> Loc .hasPos ~pos: posNoWhite then (
0 commit comments