[Top][All Lists]

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

Tree sitter: allowing access to `ts_tree_get_changed_ranges()' from elis

From: Simon Pugnet
Subject: Tree sitter: allowing access to `ts_tree_get_changed_ranges()' from elisp
Date: Sat, 26 Nov 2022 15:57:33 +0100

Dear Emacs developers,

I'm a contributor to Symex.el (<https://github.com/drym-org/symex.el>), a structural editing package based on Evil. The core package was originally designed to be used with Lisp languages but I have been working on it to add support for other languages via Tree Sitter.

This work has been going on for quite a while so I am currently using Tuấn-Anh Nguyễn's `elisp-tree-sitter' package (<https://github.com/emacs-tree-sitter/elisp-tree-sitter>). As Yuan Fu's tree-sitter branch has just been merged I decided this was a good time to look into updating Symex.el so that it can use the built-in version instead when it's available.

Progress so far has been good and I have a large portion of the functionality working with both implementations. However I've just found a feature that I'm using in `elisp-tree-sitter' that does not seem to be available in the built-in version.

Part of the functionality I use is fetching a list of ranges that have been changed between the previous and current parser trees (after an editing operation). This is exposed by `elisp-tree-sitter' via the `tsc-changed-ranges' function. From the docstring, "…This function returns a sequence of ranges whose syntactic structure has changed." I can't find an equivalent function exposed by the built-in tree sitter library however.

I've checked src/treesit.c and I can see that there is a `ts_tree_get_changed_ranges()' function, presumably from the underlying tree sitter library. However I don't think this is being exposed to elisp. Would it be possible to allow this information to be provided to elisp somehow?

Thanks in advance for your help, and apologies if this is already available and I have simply missed it.

Kind regards,

Simon Pugnet

Attachment: signature.asc
Description: PGP signature

reply via email to

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