diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/reference_tree.ml | 11 | ||||
| -rw-r--r-- | src/reference_tree.mli | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/reference_tree.ml b/src/reference_tree.ml index e920209..353a152 100644 --- a/src/reference_tree.ml +++ b/src/reference_tree.ml @@ -340,6 +340,17 @@ let get_completion_data reftree path = (data.node_type, data.multi, data.help) in List.map aux (Vytree.children_of_node @@ Vytree.get reftree path) +(* Convert from config path to reference tree path *) +let refpath reftree path = + let rec aux acc p = + match acc, p with + | [], h :: tl -> aux (acc @ [h]) tl + | _, [h] -> if is_tag reftree acc then acc else acc @ [h] + | _, h :: h' :: tl -> if is_tag reftree acc then aux (acc @ [h']) tl + else aux (acc @ [h]) ([h'] @ tl) + | _, [] -> acc + in aux [] path + module JSONRenderer = struct let render_data data = diff --git a/src/reference_tree.mli b/src/reference_tree.mli index 129e5db..964380e 100644 --- a/src/reference_tree.mli +++ b/src/reference_tree.mli @@ -62,4 +62,6 @@ val get_value_help : t -> string list -> (string * string) list val get_completion_data : t -> string list -> (node_type * bool * string) list +val refpath : t -> string list -> string list + val render_json : t -> string |
