@@ -400,7 +400,7 @@ module SyntaxTraversal =
400400 let traverseSynType = traverseSynType path
401401 let traversePat = traversePat path
402402
403- let diveIntoRecordLikeExpr path ( exprRange : range ) ( hasFields : bool ) ( copyOpt : ( SynExpr * BlockSeparator option ) option ) =
403+ let diveIntoRecordLikeExpr path ( copyOpt : ( SynExpr * BlockSeparator option ) option ) =
404404 [
405405 match copyOpt with
406406 | Some( expr, blockSep) ->
@@ -418,15 +418,20 @@ module SyntaxTraversal =
418418 else
419419 None)
420420 | None ->
421- // If there is a copy-with but no explicit separator and no fields yet,
422- // still offer field completions once the caret is after the copy expr.
423- if not hasFields then
421+ // FIXME: handle caret-after-WITH when no separator token
422+ match expr with
423+ | SynExpr.Ident id ->
424+ let idEnd = id.idRange.End
425+ let withStartPos = mkPos idEnd.Line idEnd.Column
426+ let withEndPos = mkPos idEnd.Line ( idEnd.Column + 4 )
427+ let withRange = withStartEnd withStartPos withEndPos id.idRange
424428 yield
425- dive () exprRange ( fun () ->
426- if posGeq pos expr.Range.End then
429+ dive () withRange ( fun () ->
430+ if posGeq pos withEndPos then
427431 visitor.VisitRecordField( path, Some expr, None)
428432 else
429433 None)
434+ | _ -> ()
430435 | None -> ()
431436 ]
432437
@@ -474,7 +479,8 @@ module SyntaxTraversal =
474479
475480 | SynExpr.AnonRecd( copyInfo = copyOpt; recordFields = fields) ->
476481 [
477- yield ! diveIntoRecordLikeExpr path expr.Range ( not ( List.isEmpty fields)) copyOpt
482+ yield ! diveIntoRecordLikeExpr path copyOpt
483+
478484
479485 for field, _, x in fields do
480486 yield dive () field.Range ( fun () -> visitor.VisitRecordField( path, copyOpt |> Option.map fst, Some field))
@@ -519,7 +525,8 @@ module SyntaxTraversal =
519525 | None -> ()
520526 | _ -> ()
521527
522- yield ! diveIntoRecordLikeExpr path expr.Range ( not ( List.isEmpty fields)) copyOpt
528+ yield ! diveIntoRecordLikeExpr path copyOpt
529+
523530
524531 let copyOpt = Option.map fst copyOpt
525532
0 commit comments