emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using incremental parsing in Emacs


From: HaiJun Zhang
Subject: Re: Using incremental parsing in Emacs
Date: Sat, 4 Jan 2020 12:57:24 +0800

For font-lock, I think it may work with tree-sitter like this:
1. After openning a file, parse the whole buffer with tree-sitter. We get a syntax tree from tree-sitter.
2. Get the syntax nodes with ts_node_descendant_for_point_range and fontify the buffer text in the visible region or whole buffer.
3. After each modification of buffer text, make a copy of the syntax tree as the new one. Update the new one with the modification.
4. Get the changed range and changed nodes list by comparing the old and new syntax trees. Then free the old syntax tree.
5. Update the text properties in the changed range.
6. Goto 3


reply via email to

[Prev in Thread] Current Thread [Next in Thread]