[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Recent updates to tree-sitter branch
From: |
Yuan Fu |
Subject: |
Recent updates to tree-sitter branch |
Date: |
Sat, 24 Sep 2022 21:27:40 -0700 |
Hi,
I’ve recently made some breaking changes and added some goodies to the
tree-sitter branch. If anyone have used that branch for … stuff, please have a
look at these changes:
1. I reworked the tree-traversal functions—moved them from lisp to C, and
changed their name and signature:
treesit-traverse-depth-first -> treesit-search-subtree
treesit-traverse-breadth-first ->
treesit-traverse-forward -> treesit-search-forward
treesit-search-forward -> treesit-search-forward-goto
treesit-search-beginning/end -> treesit-search-forward-goto
-> treesit-induce-sparse-tree
Treesit-induce-sparse-tree is very good for very quickly extracting a tree
containing only nodes that satisfy some condition. Maybe it should be called
treesit-extract-sparse-tree? “Sparse tree” is an invented word, I’m not aware
of a good terminology for this kind of induced tree.
2. Although treesit-font-lock-settings didn’t change,
treesit-font-lock-defaults is abandoned. You are also now supposed to use
treesit-font-lock-rules to build the queries and set it to
treesit-font-lock-settings. It is much cleaner than setting
treesit-font-lock-settings manually.
Basically:
(setq treesit-font-lock-defaults ...)
|
V
(setq treesit-font-lock-settings
(treesit-font-lock-rules
...))
3. I removed treesit-defun-query, treesit-beginning/end-of-defun.
That’s it! Happy hacking.
Yuan
- Recent updates to tree-sitter branch,
Yuan Fu <=
Re: Recent updates to tree-sitter branch, Aurélien Aptel, 2022/09/29