feat(emacs-pkgs/treecrumbs): support "JSON-style" YAML syntax
Makes crumbs work correctly for weird stuff like: ```yaml foo: - { "bar": [ { baz: 1 }]} ``` Would be nice to have tests for this at some point. Change-Id: I034e83318435404ef8613e439313dbb08865f228 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11105 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
13cced5b84
commit
eeca6cd891
1 changed files with 12 additions and 7 deletions
|
@ -36,13 +36,7 @@
|
|||
|
||||
(require 'treesit)
|
||||
|
||||
(defvar treecrumbs-languages
|
||||
`(;; In YAML documents, crumbs are generated from the keys of maps,
|
||||
;; and from elements of arrays.
|
||||
(yaml . (("block_mapping_pair" .
|
||||
,(treesit-query-compile 'yaml '((block_mapping_pair key: (_) @key))))
|
||||
("block_sequence_item" . "[]"))))
|
||||
|
||||
(defvar treecrumbs-languages nil
|
||||
"Describes the tree-sitter language grammars supported by
|
||||
treecrumbs, and how the breadcrumbs for their node types are
|
||||
generated.
|
||||
|
@ -65,6 +59,17 @@ Treecrumbs will only consider node types that are mentioned in
|
|||
the node type list. All other nodes are ignored when constructing
|
||||
the crumbs.")
|
||||
|
||||
(setq treecrumbs-languages
|
||||
`(;; In YAML documents, crumbs are generated from the keys of maps,
|
||||
;; and from elements of arrays.
|
||||
(yaml . (("block_mapping_pair" .
|
||||
,(treesit-query-compile 'yaml '((block_mapping_pair key: (_) @key))))
|
||||
("block_sequence" . "[]")
|
||||
("flow_pair" .
|
||||
;; TODO: Why can this query not match on to (flow_pair)?
|
||||
,(treesit-query-compile 'yaml '((_) key: (_) @key)))
|
||||
("flow_sequence" . "[]")))))
|
||||
|
||||
(defvar-local treecrumbs--current-crumbs nil
|
||||
"Current crumbs to display in the header line. Only updated when
|
||||
the node under point changes.")
|
||||
|
|
Loading…
Reference in a new issue