summaryrefslogtreecommitdiff
path: root/src/reference_tree.ml
diff options
context:
space:
mode:
Diffstat (limited to 'src/reference_tree.ml')
-rw-r--r--src/reference_tree.ml11
1 files changed, 11 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 =