@@ -556,27 +556,28 @@ let isCapitalized name =
556
556
match c with 'A' .. 'Z' -> true | _ -> false
557
557
558
558
type completion =
559
- | AbsAttribute of string list
559
+ | AbsAttribute of string list (* e.g. _somepath_.A.B.field *)
560
560
| RecordAccess of string list * string list * string (* e.g. A.B.var .f1.f2 .f3 *)
561
- | Normal of string list
561
+ | Path of string list (* e.g. A.B.var or A.B *)
562
562
563
563
let determineCompletion dotpath =
564
564
let rec loop dotpath =
565
565
match dotpath with
566
566
| [] -> assert false
567
- | [one] -> Normal [one]
568
- | [one; two] when not (isCapitalized one) -> RecordAccess ([one], [] , two)
569
- | [one; two] -> Normal [one; two]
567
+ | [one] -> Path [one]
568
+ | [one; two] ->
569
+ if isCapitalized one then Path [one; two]
570
+ else RecordAccess ([one], [] , two)
570
571
| one :: rest -> (
571
572
if isCapitalized one then
572
573
match loop rest with
573
- | Normal path -> Normal (one :: path)
574
+ | Path path -> Path (one :: path)
574
575
| RecordAccess (valuePath , middleFields , lastField ) ->
575
576
RecordAccess (one :: valuePath, middleFields, lastField)
576
577
| AbsAttribute _ as x -> x
577
578
else
578
579
match loop rest with
579
- | Normal path -> AbsAttribute path
580
+ | Path path -> AbsAttribute path
580
581
| RecordAccess ([name ], middleFields , lastField ) ->
581
582
RecordAccess ([one], name :: middleFields, lastField)
582
583
| x -> x)
@@ -815,8 +816,8 @@ let getItems ~full ~rawOpens ~allFiles ~pos ~dotpath =
815
816
| _ -> (
816
817
Log. log (" Completing for " ^ String. concat " <.>" dotpath);
817
818
match determineCompletion dotpath with
818
- | Normal path -> (
819
- Log. log (" normal " ^ pathToString path);
819
+ | Path path -> (
820
+ Log. log (" Path " ^ pathToString path);
820
821
match getEnvWithOpens ~pos ~env ~package ~opens path with
821
822
| Some (env , suffix ) ->
822
823
Log. log " Got the env" ;
0 commit comments