@@ -101,8 +101,8 @@ let rec traverseExpr (exp : Parsetree.expression) ~exprPath ~pos
101101        someIfHasCursor
102102          (" " Completable. NFollowRecordField  {fieldName =  fname}] @  exprPath)
103103      |  Pexp_ident  {txt  = Lident  txt }  ->
104-         (*  A var means `{s}` or similar. Complete for fields . *) 
105-         someIfHasCursor (txt, [ Completable. NRecordBody  {seenFields}]  @   exprPath)
104+         (*  A var means `{someField:  s}` or similar. Complete for identifiers or values . *) 
105+         someIfHasCursor (txt, exprPath)
106106      |  _  ->
107107        f
108108        |>  traverseExpr ~first CharBeforeCursorNoWhite ~pos 
@@ -273,24 +273,32 @@ let findJsxPropsCompletable ~jsxProps ~endPos ~posBeforeCursor
273273        with 
274274        |  Some  (prefix , nested ) ->
275275          Some 
276-             (CjsxPropValue 
276+             (Cexpression 
277277               {
278-                  pathToComponent = 
279-                    Utils. flattenLongIdent ~jsx: true  jsxProps.compName.txt;
280-                  prefix;
281-                  propName =  prop.name;
278+                  contextPath = 
279+                    CJsxPropValue 
280+                      {
281+                        pathToComponent = 
282+                          Utils. flattenLongIdent ~jsx: true  jsxProps.compName.txt;
283+                        propName =  prop.name;
284+                      };
282285                 nested =  List. rev nested;
286+                  prefix;
283287               })
284288        |  _  -> None 
285289      else  if  prop.exp.pexp_loc |>  Loc. end_ =  (Location. none |>  Loc. end_) then 
286290        if  isExprHole prop.exp then 
287291          Some 
288-             (CjsxPropValue 
292+             (Cexpression 
289293               {
290-                  pathToComponent = 
291-                    Utils. flattenLongIdent ~jsx: true  jsxProps.compName.txt;
294+                  contextPath = 
295+                    CJsxPropValue 
296+                      {
297+                        pathToComponent = 
298+                          Utils. flattenLongIdent ~jsx: true  jsxProps.compName.txt;
299+                        propName =  prop.name;
300+                      };
292301                 prefix =  " " 
293-                  propName =  prop.name;
294302                 nested =  [] ;
295303               })
296304        else  None 
@@ -382,19 +390,27 @@ let findArgCompletables ~(args : arg list) ~endPos ~posBeforeCursor
382390        |  None  -> None 
383391        |  Some  (prefix , nested ) ->
384392          Some 
385-             (Cargument 
393+             (Cexpression 
386394               {
387-                  functionContextPath =  contextPath;
388-                  argumentLabel =  Labelled  labelled.name;
395+                  contextPath = 
396+                    CArgument 
397+                      {
398+                        functionContextPath =  contextPath;
399+                        argumentLabel =  Labelled  labelled.name;
400+                      };
389401                 prefix;
390402                 nested =  List. rev nested;
391403               })
392404      else  if  isExprHole exp then 
393405        Some 
394-           (Cargument 
406+           (Cexpression 
395407             {
396-                functionContextPath =  contextPath;
397-                argumentLabel =  Labelled  labelled.name;
408+                contextPath = 
409+                  CArgument 
410+                    {
411+                      functionContextPath =  contextPath;
412+                      argumentLabel =  Labelled  labelled.name;
413+                    };
398414               prefix =  " " 
399415               nested =  [] ;
400416             })
@@ -410,20 +426,29 @@ let findArgCompletables ~(args : arg list) ~endPos ~posBeforeCursor
410426        |  None  -> None 
411427        |  Some  (prefix , nested ) ->
412428          Some 
413-             (Cargument 
429+             (Cexpression 
414430               {
415-                  functionContextPath =  contextPath;
416-                  argumentLabel = 
417-                    Unlabelled  {argumentPosition =  ! unlabelledCount};
431+                  contextPath = 
432+                    CArgument 
433+                      {
434+                        functionContextPath =  contextPath;
435+                        argumentLabel = 
436+                          Unlabelled  {argumentPosition =  ! unlabelledCount};
437+                      };
418438                 prefix;
419439                 nested =  List. rev nested;
420440               })
421441      else  if  isExprHole exp then 
422442        Some 
423-           (Cargument 
443+           (Cexpression 
424444             {
425-                functionContextPath =  contextPath;
426-                argumentLabel =  Unlabelled  {argumentPosition =  ! unlabelledCount};
445+                contextPath = 
446+                  CArgument 
447+                    {
448+                      functionContextPath =  contextPath;
449+                      argumentLabel = 
450+                        Unlabelled  {argumentPosition =  ! unlabelledCount};
451+                    };
427452               prefix =  " " 
428453               nested =  [] ;
429454             })
@@ -436,11 +461,15 @@ let findArgCompletables ~(args : arg list) ~endPos ~posBeforeCursor
436461        |  Some  '~'  -> Some  (Completable. CnamedArg  (contextPath, " " 
437462        |  _  ->
438463          Some 
439-             (Cargument 
464+             (Cexpression 
440465               {
441-                  functionContextPath =  contextPath;
442-                  argumentLabel = 
443-                    Unlabelled  {argumentPosition =  ! unlabelledCount};
466+                  contextPath = 
467+                    CArgument 
468+                      {
469+                        functionContextPath =  contextPath;
470+                        argumentLabel = 
471+                          Unlabelled  {argumentPosition =  ! unlabelledCount};
472+                      };
444473                 prefix =  " " 
445474                 nested =  [] ;
446475               })
@@ -453,10 +482,14 @@ let findArgCompletables ~(args : arg list) ~endPos ~posBeforeCursor
453482  ]
454483    when  fnHasCursor ->
455484    Some 
456-       (Completable. Cargument 
485+       (Completable. Cexpression 
457486         {
458-            functionContextPath =  contextPath;
459-            argumentLabel =  Unlabelled  {argumentPosition =  0 };
487+            contextPath = 
488+              CArgument 
489+                {
490+                  functionContextPath =  contextPath;
491+                  argumentLabel =  Unlabelled  {argumentPosition =  0 };
492+                };
460493           prefix =  " " 
461494           nested =  [] ;
462495         })
@@ -841,7 +874,7 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
841874      setResult
842875        (Completable. Cpattern 
843876           {
844-              typ  =  ctxPath;
877+              contextPath  =  ctxPath;
845878             prefix;
846879             nested =  List. rev nestedPattern;
847880             fallback =  None ;
@@ -910,7 +943,12 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
910943        |  Some  ctxPath  ->
911944          setResult
912945            (Completable. Cpattern 
913-                {typ =  ctxPath; nested =  [] ; prefix =  " " =  None }))
946+                {
947+                  contextPath =  ctxPath;
948+                  nested =  [] ;
949+                  prefix =  " " 
950+                  fallback =  None ;
951+                }))
914952      |  Pexp_match  (exp , cases ) -> (
915953        (*  If there's more than one case, or the case isn't a pattern hole, figure out if we're completing another
916954           broken parser case (`switch x { | true => () | <com> }` for example). *)  
@@ -937,7 +975,12 @@ let completionWithParser1 ~currentFile ~debug ~offset ~path ~posCursor ~text =
937975            (*  If there's no case with the cursor, but a broken parser case, complete for the top level. *) 
938976            setResult
939977              (Completable. Cpattern 
940-                  {typ =  ctxPath; nested =  [] ; prefix =  " " =  None })
978+                  {
979+                    contextPath =  ctxPath;
980+                    nested =  [] ;
981+                    prefix =  " " 
982+                    fallback =  None ;
983+                  })
941984          |  false , false  -> () ))
942985      |  _  -> unsetLookingForPat () 
943986  in 
0 commit comments