@@ -400,7 +400,7 @@ module SyntaxTraversal =
400
400
let traverseSynType = traverseSynType path
401
401
let traversePat = traversePat path
402
402
403
- let diveIntoRecordLikeExpr path ( exprRange : range ) ( hasFields : bool ) ( copyOpt : ( SynExpr * BlockSeparator option ) option ) =
403
+ let diveIntoRecordLikeExpr path ( copyOpt : ( SynExpr * BlockSeparator option ) option ) =
404
404
[
405
405
match copyOpt with
406
406
| Some( expr, blockSep) ->
@@ -418,15 +418,21 @@ module SyntaxTraversal =
418
418
else
419
419
None)
420
420
| 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
428
+
424
429
yield
425
- dive () exprRange ( fun () ->
426
- if posGeq pos expr.Range.End then
430
+ dive () withRange ( fun () ->
431
+ if posGeq pos withEndPos then
427
432
visitor.VisitRecordField( path, Some expr, None)
428
433
else
429
434
None)
435
+ | _ -> ()
430
436
| None -> ()
431
437
]
432
438
@@ -474,7 +480,7 @@ module SyntaxTraversal =
474
480
475
481
| SynExpr.AnonRecd( copyInfo = copyOpt; recordFields = fields) ->
476
482
[
477
- yield ! diveIntoRecordLikeExpr path expr.Range ( not ( List.isEmpty fields )) copyOpt
483
+ yield ! diveIntoRecordLikeExpr path copyOpt
478
484
479
485
for field, _, x in fields do
480
486
yield dive () field.Range ( fun () -> visitor.VisitRecordField( path, copyOpt |> Option.map fst, Some field))
@@ -519,7 +525,7 @@ module SyntaxTraversal =
519
525
| None -> ()
520
526
| _ -> ()
521
527
522
- yield ! diveIntoRecordLikeExpr path expr.Range ( not ( List.isEmpty fields )) copyOpt
528
+ yield ! diveIntoRecordLikeExpr path copyOpt
523
529
524
530
let copyOpt = Option.map fst copyOpt
525
531
0 commit comments