@@ -396,47 +396,49 @@ let locItemToString {loc = {Location.loc_start; loc_end}; locType} =
396396(* needed for debugging *)
397397let _ = locItemToString
398398
399- (* Completion context *)
400- type completionContext = Type | Value | Module | Field
401-
402- type contextPath =
403- | CPString
404- | CPArray
405- | CPId of string list * completionContext
406- | CPField of contextPath * string
407- | CPObj of contextPath * string
408- | CPPipe of contextPath * string
409-
410- type completable =
411- | Cdecorator of string (* * e.g. @module *)
412- | Clabel of string list * string * string list
413- (* * e.g. (["M", "foo"], "label", ["l1", "l2"]) for M.foo(...~l1...~l2...~label...) *)
414- | Cpath of contextPath
415- | Cjsx of string list * string * string list
416- (* * E.g. (["M", "Comp"], "id", ["id1", "id2"]) for <M.Comp id1=... id2=... ... id *)
417-
418- let completableToString =
419- let str s = if s = " " then " \"\" " else s in
420- let list l = " [" ^ (l |> List. map str |> String. concat " , " ) ^ " ]" in
421- let completionContextToString = function
422- | Value -> " Value"
423- | Type -> " Type"
424- | Module -> " Module"
425- | Field -> " Field"
426- in
427- let rec contextPathToString = function
428- | CPString -> " string"
429- | CPArray -> " array"
430- | CPId (sl , completionContext ) ->
431- completionContextToString completionContext ^ list sl
432- | CPField (cp , s ) -> contextPathToString cp ^ " ." ^ str s
433- | CPObj (cp , s ) -> contextPathToString cp ^ " [\" " ^ s ^ " \" ]"
434- | CPPipe (cp , s ) -> contextPathToString cp ^ " ->" ^ s
435- in
436- function
437- | Cpath cp -> " Cpath " ^ contextPathToString cp
438- | Cdecorator s -> " Cdecorator(" ^ str s ^ " )"
439- | Clabel (sl1 , s , sl2 ) ->
440- " Clabel(" ^ (sl1 |> list ) ^ " , " ^ str s ^ " , " ^ (sl2 |> list ) ^ " )"
441- | Cjsx (sl1 , s , sl2 ) ->
442- " Cjsx(" ^ (sl1 |> list ) ^ " , " ^ str s ^ " , " ^ (sl2 |> list ) ^ " )"
399+ module Completable = struct
400+ (* Completion context *)
401+ type completionContext = Type | Value | Module | Field
402+
403+ type contextPath =
404+ | CPString
405+ | CPArray
406+ | CPId of string list * completionContext
407+ | CPField of contextPath * string
408+ | CPObj of contextPath * string
409+ | CPPipe of contextPath * string
410+
411+ type t =
412+ | Cdecorator of string (* * e.g. @module *)
413+ | Clabel of string list * string * string list
414+ (* * e.g. (["M", "foo"], "label", ["l1", "l2"]) for M.foo(...~l1...~l2...~label...) *)
415+ | Cpath of contextPath
416+ | Cjsx of string list * string * string list
417+ (* * E.g. (["M", "Comp"], "id", ["id1", "id2"]) for <M.Comp id1=... id2=... ... id *)
418+
419+ let toString =
420+ let str s = if s = " " then " \"\" " else s in
421+ let list l = " [" ^ (l |> List. map str |> String. concat " , " ) ^ " ]" in
422+ let completionContextToString = function
423+ | Value -> " Value"
424+ | Type -> " Type"
425+ | Module -> " Module"
426+ | Field -> " Field"
427+ in
428+ let rec contextPathToString = function
429+ | CPString -> " string"
430+ | CPArray -> " array"
431+ | CPId (sl , completionContext ) ->
432+ completionContextToString completionContext ^ list sl
433+ | CPField (cp , s ) -> contextPathToString cp ^ " ." ^ str s
434+ | CPObj (cp , s ) -> contextPathToString cp ^ " [\" " ^ s ^ " \" ]"
435+ | CPPipe (cp , s ) -> contextPathToString cp ^ " ->" ^ s
436+ in
437+ function
438+ | Cpath cp -> " Cpath " ^ contextPathToString cp
439+ | Cdecorator s -> " Cdecorator(" ^ str s ^ " )"
440+ | Clabel (sl1 , s , sl2 ) ->
441+ " Clabel(" ^ (sl1 |> list ) ^ " , " ^ str s ^ " , " ^ (sl2 |> list ) ^ " )"
442+ | Cjsx (sl1 , s , sl2 ) ->
443+ " Cjsx(" ^ (sl1 |> list ) ^ " , " ^ str s ^ " , " ^ (sl2 |> list ) ^ " )"
444+ end
0 commit comments