about summary refs log tree commit diff
path: root/tools/emacs-pkgs/treecrumbs/treecrumbs.el
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@tvl.su>2024-03-10T17·02+0300
committerclbot <clbot@tvl.fyi>2024-03-10T19·35+0000
commit6280706ecd17e889e0dd42ac3845864ed7e2e49e (patch)
treeef4918d33d390b17df2593e4d319a73d741301e3 /tools/emacs-pkgs/treecrumbs/treecrumbs.el
parent3b7e546dfc0fbd85c4e7ca88a489a8e2ee4f1d74 (diff)
feat(treecrumbs): support for JSON r/7671
Fairly similar to YAML, except with only one way of naming keys and
arrays.

Change-Id: Ic2fa539466d69af55b36401bb8c03f2c7edcd91d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11112
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tools/emacs-pkgs/treecrumbs/treecrumbs.el')
-rw-r--r--tools/emacs-pkgs/treecrumbs/treecrumbs.el5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/emacs-pkgs/treecrumbs/treecrumbs.el b/tools/emacs-pkgs/treecrumbs/treecrumbs.el
index a01e5490fa7f..54e2160385a0 100644
--- a/tools/emacs-pkgs/treecrumbs/treecrumbs.el
+++ b/tools/emacs-pkgs/treecrumbs/treecrumbs.el
@@ -90,6 +90,11 @@ The defined languages are stored in `treecrumbs-languages'."
   ("flow_pair" . ((_) key: (_) @key))
   ("flow_sequence" . "[]"))
 
+(define-treecrumbs-language json
+  ;; In JSON documents, crumbs are generated from key names and array fields.
+  ("pair" . ((pair key: (string (string_content) @key))))
+  ("array" . "[]"))
+
 (define-treecrumbs-language cpp
   ;; In C++ files, crumbs are generated from namespaces and
   ;; identifier declarations.